Syntax for passing JavaScript variables as extra parameters
We can pass a JavaScript variable as an extra parameter to any of the tags for IBM Digital Analytics.The syntax rules are:
- We can use the simplified JavaScript format for the extraparms values, but we must use the prefix jsvar for the JavaScript variable.
Example
Consider the following JavaScript snippet:<script type="text/JavaScript"> var jsExtraParamValue = "abc_123"; </script>
This snippet defines a JavaScript variable named jsExtraParamValue that has a value of abc_123. To pass the value to the IBM Digital Analytics tags, use the syntax that applies to your feature pack level as demonstrated in these examples:
- Use the simplified JavaScript format for the value, and use the prefix jsvar for the JavaScript variable:
<cm:pageview extraparms="jsvar:jsExtraParamValue"/>
Related concepts
Passing extra data to IBM Digital Analytics with the extraparms parameter
Comparison of extra parameters for IBM Digital Analytics tags
Related reference
Use the product tag with IBM Digital Analytics
Use the registration tag with IBM Digital Analytics
Use the shopping cart tag with IBM Digital Analytics