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, something that we tell users not to do under most circumstances, because there’s a strong likelihood of breaking the link.

For this reason, we consider this to be an advanced feature, so be careful.

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 like, by adding an ampersand, then the variable name, 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, the name of the variable, an equals sign, then the value for that variable.

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?