Follow

Adding variables into tags

It is possible to pass a variable within the Switch tags with some manual adjustment to the tags.

Please note, these are the only modifications we permit of our tags.

First extract your invocation code from the adserver and place into a notepad file. It will look like this:

<!-- Ad Unit [1661] test *x* -->
<div id="switch_placeholder_e453d86b5da036ab4b4dd9ee51f38460" class="switch_placeholder"></div>
<script> (__scads = window.__scads || []).push({"z":1661,"targetId":"switch_placeholder_e453d86b5da036ab4b4dd9ee51f38460","domain":"delivery.heavyhearted.com"}); </script>
<script async src="//delivery.xyz123.com/adserver/sat.js?v=2"></script>

At this stage, the variable needs to be edited into the tag by entering it in the push function {}. Each variable will be comma separated. Identify the end of the first string by locating the first comma (",")  then first enter "variables" ( as shown in quotes) following this with the variable value in name:value format (key value pair) e.g:

"variables":{ example:"www.example.com"},

Your tag should now look like this:

<!-- Ad Unit [1661] test *x* -->
<div id="switch_placeholder_e453d86b5da036ab4b4dd9ee51f38460" class="switch_placeholder"></div>
<script> (__scads = window.__scads || []).push({"z":1661,"variables":{ example:"www.example.com"},"targetId":"switch_placeholder_e453d86b5da036ab4b4dd9ee51f38460","domain":"delivery.heavyhearted.com"}); </script>
<script async src="//delivery.xyz123.com/adserver/sat.js?v=2"></script>

 

Its also possible to insert multiple variables in the following format with a comma (",") separation (without quotes) e.g:

"variables":{example:"value", gender:"male"},

So your tag would look like this:

<!-- Ad Unit [1661] test *x* -->
<div id="switch_placeholder_e453d86b5da036ab4b4dd9ee51f38460" class="switch_placeholder"></div>
<script> (__scads = window.__scads || []).push({"z":1661,"variables":{ example:"value", gender:"male"},"targetId":"switch_placeholder_e453d86b5da036ab4b4dd9ee51f38460","domain":"delivery.heavyhearted.com"}); </script>
<script async src="//delivery.xyz123.com/adserver/sat.js?v=2"></script>