Using Custom Variables with Pop-Up / Web Intercept Links

As with any other link, it is possible to use Pop Up / Web Intercept alongside the Custom Variable feature. This requires the user to edit the Install Code of the Pop-Up link. Please read the box below carefully before proceeding.

Under most circumstances we tell users specifically not to edit the Install Code of the pop-up link as there is a strong likelihood of breaking the link. For this reason, we consider this to be an advanced feature, so caution is advised.

This method only works with specifically-named custom variables, and only up to 7 of them. so to start with you'll need to create the variables.

Creating the Variables

You create the variables for your survey in the usual way described in the Custom Variable guide. However, they must be named x1, x2, x3, x4, x5, x6, or x7

OTHER VARIABLE NAMES WILL NOT WORK.

You can still use labels of your choosing though. Once this is done, you then need to create the web embed tracking link.

Appending Custom Variable Code to the Default Install Code

The install code uses Javascript, and looks like the below:



This is what you need to paste into your website code on the pages where you want the pop-up to be active.

You need to look in the code for a section that reads as follows:

var _ssq= {'cid':12345678}

12345678 is a placeholder for this example as this value is specific to each link.

The values for the custom variables are added as part of this section in the curly brackets in the following format:

'custom_variable1':'value', 'custom_variable2':'value',

And so on, up to custom_variable7 if desired. The value that's set in the Javascript for "custom_variableN", will be loaded into the survey as variable named "xN". So, custom_variable1 will appear in the survey as x1. 

So, for our example, if we're using x1 for "city" and x2 for "country" the full section of the bracketed section should read: 

var _ssq= {'cid':12345678 , 'custom_variable1' : 'London' , 'custom_variable2' : 'England' }

If you need the values for the variables to vary, then you'll need to create code in the web page to amend the values in this block of the install code before loading and displaying the page.

Was this guide helpful?