First before we dwell into the world on passing variables to it would be good to read about macros as an overall here.

Accessing macros in your HTML container

Nexd tags have two possibilities to access macros in HTML container – the Javascript way or via predefined variables.

Javascript method

In all Nexd tag environments you are able to access tag variables via nexdAPI object.

E.g.

Having a tag:

<ins class="adcads"
data-adc-id="LIVEID"
data-unit="LIVEID"
data-clickable="yes"
data-redir="yes"
data-click-tracker="%%CLICK_URL_UNESC%%https://www.nexd.com/example"
data-click-macro="%%CLICK_URL_UNESC%%"
data-responsive="yes"
data-width="640"
data-height="360"
data-macro-Var1="MyMacroVariable1"
data-macro-Var2="MyMacroVariable2">
<script src="https://media.adcanvas.com/LIVEID/adtag.js" type="text/javascript"></script>
</ins>

You can use in HTML:

<html>
<head>
</head>
<body>
...
<script>
var clickTracker = nexdAPI.clicktracker;
var adWidth = nexdAPI.width;
var adHeight = nexdAPI.height;
var yourMacroVariable1 = nexdAPI.macrovar1;
var yourMacroVariable2 = nexdAPI.macrovar2;
</script>
</body>
</html>

Predefined variables in code

Another way to access is to mark in your HTML code the variables via macros so that they will be passed on.

PS: these variables will only be changed in the main HTML file.

E.g.

Having a tag:

<ins class="adcads"
data-adc-id="LIVEID"
data-unit="LIVEID"
data-clickable="yes"
data-redir="yes"
data-click-tracker="%%CLICK_URL_UNESC%%https://www.nexd.com/example"
data-click-macro="%%CLICK_URL_UNESC%%"
data-responsive="yes"
data-width="640"
data-height="360"
data-macro-Var1="MyMacroVariable1"
data-macro-Var2="MyMacroVariable2">
<script src="https://media.adcanvas.com/LIVEID/adtag.js" type="text/javascript"></script>
</ins>

You can use in HTML:

<html>
<head>
</head>
<body>
...
<p> This creative variable 1 macro is: <strong>${Var1}</strong>
<script>
var yourMacroVariable2 = '${Var2}';
</script>

</body>
</html>

These changes are done with a simple find and replace inside the HTML code on initiation. Macros are supported in method like:

{Var1}
${Var1}
{{Var1}}
${{Var1}}

If you have any questions or request changes to the functionality, please reach out to [email protected].

Did this answer your question?