1. Home
  2. Using Nudges
  3. Add Variables To Your Custom Nudges

Add Variables To Your Custom Nudges

With Nudify, you can pass JavaScript Variables from your site in your Custom Nudges using braces { }.

Say you want to add a Custom Nudge that shows the warranty of different items, you can pass the number of years for warranty and the product category in your Custom Nudge.

Read how to do this below.

Step 1: Pass the variables you want to Nudgify

If you use JavaScript variables on your website, you can pass these to Nudgify by adding them to your Nudgify Pixel. In our example of warranty and product category, you could add the following line to your Pixel:

window.nudgify = {variables: {warrantyyears: numberOfYears, category: itemCategory}}

Step 2: Push the variables in your Custom Nudge message

Now, you can push these variables in your Custom Nudge message by adding the variable names in braces. For example:

{warrantyyears}-year warranty on all {category} items


Depending on the page on your site, the actual message in your Nudge will then show for example ‘2-year warranty on all electronic items’ or ‘1-year warranty on all kitchenware items’.

As you can see in the screenshot above, the preview on the right shows the plain text you typed in. Only when the Nudge is live, it will capture and show the data from your pages.

Updated on July 21, 2020

Was this article helpful?

Related Articles