Conversion Tracking with Variables | Community
Skip to main content
New Participant
August 21, 2017
Solved

Conversion Tracking with Variables

  • August 21, 2017
  • 1 reply
  • 745 views

Hello,

I want to integrate a Tracking Pixel with variables:

<iframe src="https://tbs.tradedoubler.com/report?organization=7362551&event=917835654&orderNumber=[VARIABLE]&orderValue=[Transaction_value]&currency=[Currency]&tduid=[TDUID]&type=iframe&voucher=[VoucherCode]&validOn=[validOn]" 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!

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by jantzen_b

Hi,

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); }

1 reply

jantzen_b
jantzen_bAccepted solution
Employee
August 21, 2017

Hi,

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); }