Conversion Tracking with Variables




I want to integrate a Tracking Pixel with variables:

<iframe src="[VARIABLE]&orde..." height="1" width="1" border="0"/>

The variables [VARIABLE], [Transaction_value] and [Currency] are still on my site in the data layer:

[variable] = _satellite.getVar("transactionID")

[Transaction_value] = _satellite.getVar("transactionRevenue")

[Currency] = _satellite.getVar("transactionCurrency")

1. How can I get this data layer veariables in the Conversion Code?

2. What implementation method should I use in the rule (sequentiell HTML, sequentiell java, not sequentiell)?

Many thanks!

Accepted Solutions (1)

Accepted Solutions (1)


Community Manager



The pixel you provided is an HTML iframe. By default, that tag does not support dynamic variables. In order to dynamically populate a variable, you will need to use some sort of script to populate the URL. Below is one way you can accomplish this, but you can find others by doing a quick search for "dynamically populating iframe src".

In this case, you'd deploy an <iframe> tag, preferably with a unique id. Then you'd deploy a version of the script below where you populate the url that will then be dynamically injected into the iframe. In the script below, you should be able to use  _satellite_getVar() to retrieve the value of DTM data elements.

window.onload = function() { var url; //You can get this url dynamically from an ajax request or from a form etc 

// To Do : A function to populate url with a valid url from any method you prefer. 

// Set an ID for the iframe. Let us give that an id of myframe

document.getElementById("myframe").setAttribute("src", url); }

Answers (0)