Adding Custom Variables to Email Tool Invitations

There are occasional situations where you might need to append extra custom variable details to the link that’s sent to contacts via the Email Tool.

For instance, you may have a contact list that you wish to be mostly anonymous, but pass through selected custom column data (Such as perhaps a region or department).

By using this method, this data can be passed in to the survey from a custom column, but the remainder of any information from the contact list will be unavailable to the survey results.

Also, while we do strive, in these guides, not to get too deep into HTML, it’s unavoidable for this guide to at least mention it. It’s pretty basic, though, so please don’t let that put you off.

The [SURVEYLINK] Merge Tag

If you send invitations using the email tool, you’ll be familiar with the [SURVEYLINK] tag that appears in your invitations. When the email is sent, this is replaced by the HTML code for the survey link. It’s important to point out that it’s the HTML code for the link, and not just the web address (known as a URL). In HTML, links are defined with "href" tags. So what gets put in the email looks a bit like this:

<a href="https://www.smartsurvey.co.uk/s/ABCDEF?m=123456">https://www.smartsurvey/s/ABCDEF?m=123456</a>

The part in quote marks is the actual link destination and the part between the pointy brackets is just what’s shown to the reader and these can be different.

What this means though is that if you try adding the code for a custom variable (for instance, "region"), it won’t work because this will get placed after the </a>, which closes off the link. The code will appear next to the link text but won't be part of it, looking a bit like:

https://www.smartsurvey.co.uk/s/ABCDEF?m=123456&region=value

[SURVEYLINK_NL] - The Alternative

The [SURVEYLINK_NL] tag adds the pure URL to the email content, without the href tags. This allows the email creator much more freedom in what happens to the link. It is possible to simply put the tag into the email content as-is, with no extra code, and some email clients will make it a clickable link. Not all will though, so for maximum usability, you would need to choose "Source" when editing the email and add it in an href tag like above.

<a href="[SURVEYLINK_NL]&region=value">Click here to complete the survey</a>

and all the recipient will see is:

Click here to complete the survey

Putting it all together with a Custom Column

Now in the above examples, we’ve just put "&region=value" but in most cases, you’ll want to pipe this from a custom column, so if this is our first custom column, we would change "value" to "[COLUMN1]".

The complete process would then break down as follows:

1: Create survey and create the custom variable

2: Create the contact list with your custom columns

3: When creating the email, replace [SURVEYLINK] in the email source code with the code detailed above, customised to fit your chosen variables.

What About SMS? This process can also be used for SMS invitations, with the following changes:
Firstly, there's no need to use [surveylink_nl]. Also, because the SMS links are structured differently to email links, you need to start with a "?" not a "&" after [surveylink], then the variable name and then value, like this [SURVEYLINK]?g=m. Finally, you'll want to make sure you keep your variable names and values as short as possible so you stay within the SMS text length limit.


Was this guide helpful?