Using Custom Variables with Web Embed Links

As with any other link, it is possible to use Web Embed links alongside the Custom Variable feature. This requires the user to edit the Install Code of the web embed link. Please read the box below carefully before proceeding.

Under most circumstances we tell users specifically not to edit the Install Code of the web embed 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

Appending Custom Variable Code to the Default Install Code

The default install code uses Javascript. You need to look in the code for a section that reads as follows:

www.smartsurvey.co.uk/s/r/embed.aspx?i=123456&c=890123

123456 and 890123 are placeholders as these values are specific to each link. Add the custom variable to the end of this section, but before the apostrophe in the same way as you would when adding several Custom Variables to any other link, by adding an ampersand, then the variable name, an equals sign, and then the variable value:

www.smartsurvey.co.uk/s/r/embed.aspx?i=123456&c=890123&variable1=value1&variable2=value2’

Appending Custom Variable Code to the iframe Install Code

The iframe install code that is shown when you click on “My embed code is not working…” uses HTML and so is relatively easy to understand. If you inspect the code, you’ll see the tracking link close to the start after an “src=” tag. Add the custom variable after the “/” in the usual way by adding a question mark, then the variable name, an equals sign, and then the variable value.

The link also appears later in the code in an href tag as a backup, and you should add the variable to this link as well in the same way as in the src tag.


Was this guide helpful?