Container Tag

Manage all your marketing tags across your site with ease.

Overview

A Container Tag is a single piece of JavaScript code that is implemented on a merchant's web site. Container tags make it easier for merchants to add, change, or remove marketing tags, because they provide a delivery mechanism for the tags they contain. The changes are done in one single place within the Container Tag interface, instead of writing code for tags page by page on the web site.

So what are TAGs?

  • Tags are critical to online marketing as they are essentially the means by which data is collected on a website.
  • A tag may be a simple 1x1 transparent pixel or image tag loaded onto the web page.
  • A tag could also take the form of JavaScript code that allows for more advanced data collection as in the case of Container Tags.
  • Tags are incorporated into the HTML/JavaScript code delivered by a web browser or app when a web page loads.
  • Tags have different functions, for example:
    • Instruct web browsers to collect data
    • Set cookies on the visitor's web page
    • Integrate third-party content into a website (e.g. social media widgets, video players, ads, etc.)

Merchant benefits

  • Saving technical resources – you just need to implement CT once.
  • Fast implementation – adding CT is a quick process and allows you to work with different online partners
  • Flexibility in choosing which affiliates you partner with – you can implement inside of CT as many partners as you wish to work with.
  • Simplicity in implementation of additional tags – you can add analytics tools or Facebook’s “Like button”
  • Saving time – you add new tags or scripts inside of CT and not on your website
 

What is retargeting and why to use it?

Retargeting affiliates are companies working with merchants through the affiliate network as a retargeting service provider. Retargeting companies are running display ad campaigns targeted at visitors who have recently visited a merchant's site. Some of these companies have their own ad-networks, while others buy traffic from ad-networks, portals and ad-exchanges
  • Extensive reach: major portals and ad-networks are accessible by using retargeting providers.
  • Return conversion rates are increased because of higher click-through rates.
  • Build brand awareness and loyalty.
  • Tailor your message based on visitor's interest.
  • Show relevant offers to consumers.
  • Increase sales & leads generation.

Implementation

TradeDoubler suggests to add up to six different container tags to your site. Please implement container tags at least on the home page and check-out page.
  • Homepage Tag - implement on non-product related pages
  • Product Listings Tag - implementation on category sites or search results pages
  • Product Pages Tag - implementation on product detail pages
  • Basket Page Tag - implementation in the shopping cart
  • Registration Tag – implemented where client can sign up for newsletter
  • Check-out Page Tag - implementation on the merchant's checkout page

Tips!

  • All parameters with [] should be filled in (e.g. [currency] will be EUR).
  • ContainerTagId is the id found in TradeDoubler's system or ask your contact at TradeDoubler. For every of the 5 cases described above there is a unique id.
  • Other parameters have to be filled in by the customer implementation.
  • All parameters in TDConf.Config should be strings with quotes(").
  • Variables are case sensitive.
  • All variables should be placed under the TDConf namespace to prevent errors in conflicts.
  • Decimal separators should be dots.
  • For currencies please use ISO 4217 standard (http://en.wikipedia.org/wiki/ISO_4217).
  • Please ensure that all product ids are the same you provide us within your product feeds.
  • URLs have to have a valid syntax. Please see http://en.wikipedia.org/wiki/Uniform_Resource_Locator#Syntax
TradeDoubler suggests using asynchronous script version to avoid long loading time of your website. This version requires also less hardware and set-up process is quicker as synchronous. It’s also compatible with GTM (Google Tag Manager).

Step by step

Home page

Tag to be inserted on frontpage and not product specific pages (case 1)
=======================================================================

<script type="text/javascript">

		$async = true; // true : Asynchronous script     /     false : Synchronous Script


function getVar(name) {
	get_string = document.location.search;
	return_value = '';
	do {
		name_index = get_string.indexOf(name + '=');
		if(name_index != -1) {
			get_string = get_string.substr(name_index + name.length + 1,
			get_string.length - name_index);
			end_of_value = get_string.indexOf('&');
			if(end_of_value != -1) {
				value = get_string.substr(0, end_of_value);
			} else {
				value = get_string;
			}
			if(return_value == '' || value == '') {
				return_value += value;
			} else {
				return_value += ', ' + value;
			}
		}
	}
	while(name_index != -1) {
		space = return_value.indexOf('+');
	}
	while(space != -1) {
		return_value = return_value.substr(0, space) + ' ' +
		return_value.substr(space + 1, return_value.length);
		space = return_value.indexOf('+');
	}
	return(return_value);
}
function setCookie(name, value, expires, path, domain, secure) {
               var today = new Date();
               today.setTime( today.getTime() );
               if ( expires ) {
                              expires = expires * 1000 * 60 * 60 * 24;
               }
               var expires_date = new Date( today.getTime() + (expires) );
               document.cookie= name + "=" + escape(value) +
               ((expires) ? "; expires=" + expires_date.toGMTString() : "") +
               ((path) ? "; path=" + path : "") +
               ((domain) ? "; domain=" + domain : "") +
               ((secure) ? "; secure" : "");
}
var mytduid = getVar('tduid');

if  (mytduid!='')
{

setCookie('TRADEDOUBLER', mytduid, 365, '/', '.domain.com');
}


var TDConf = TDConf || {};
TDConf.Config = {
	protocol : document.location.protocol,
	containerTagId : "XXXX"
};

if(typeof (TDConf) != "undefined"){
	TDConf.sudomain = ("https:" == document.location.protocol) ? "swrap" : "wrap";
	TDConf.host = ".tradedoubler.com/wrap";
	TDConf.containerTagURL = (("https:" == document.location.protocol) ? "https://" : "http://")  + TDConf.sudomain + TDConf.host;

	if (typeof (TDConf.Config) != "undefined") {
		if ($async){

			   var TDAsync = document.createElement('script');
					TDAsync.src = TDConf.containerTagURL  + "?id="+ TDConf.Config.containerTagId;
					TDAsync.async = "yes";
					TDAsync.width = 0;
					TDAsync.height = 0;
			TDAsync.frameBorder = 0;
				document.body.appendChild(TDAsync);
		}
		else{
				document.write(unescape("%3Cscript src='" + TDConf.containerTagURL  + "?id="+ TDConf.Config.containerTagId +" ' type='text/javascript'%3E%3C/script%3E"));
		}
	}
}
</script>
XXXX – will be replaced by ID provided by TradeDoubler

Product listing pages

Tag to be inserted on product listing pages (case 2)
====================================================

<script type="text/javascript">

		$async = true; // true : Asynchronous script     /     false : Synchronous Script

function getVar(name) {
	get_string = document.location.search;
	return_value = '';
	do {
		name_index = get_string.indexOf(name + '=');
		if(name_index != -1) {
			get_string = get_string.substr(name_index + name.length + 1,
			get_string.length - name_index);
			end_of_value = get_string.indexOf('&');
			if(end_of_value != -1) {
				value = get_string.substr(0, end_of_value);
			} else {
				value = get_string;
			}
			if(return_value == '' || value == '') {
				return_value += value;
			} else {
				return_value += ', ' + value;
			}
		}
	}
	while(name_index != -1) {
		space = return_value.indexOf('+');
	}
	while(space != -1) {
		return_value = return_value.substr(0, space) + ' ' +
		return_value.substr(space + 1, return_value.length);
		space = return_value.indexOf('+');
	}
	return(return_value);
}
function setCookie(name, value, expires, path, domain, secure) {
               var today = new Date();
               today.setTime( today.getTime() );
               if ( expires ) {
                              expires = expires * 1000 * 60 * 60 * 24;
               }
               var expires_date = new Date( today.getTime() + (expires) );
               document.cookie= name + "=" + escape(value) +
               ((expires) ? "; expires=" + expires_date.toGMTString() : "") +
               ((path) ? "; path=" + path : "") +
               ((domain) ? "; domain=" + domain : "") +
               ((secure) ? "; secure" : "");
}
var mytduid = getVar('tduid');

if  (mytduid!='')
{

setCookie('TRADEDOUBLER', mytduid, 365, '/', '.domain.com');
}


var TDConf = TDConf || {};
TDConf.Config = {
  products:[
    {id: "[product-id1]", price:"[price1]", currency:"[currency1]", name:"[product-name1]"},
    {id: "[product-id2]", price:"[price2]", currency:"[currency2]", name:"[product-name2]"},
    ...
  ],
  Category_name : "[Name of category products]",
	containerTagId : "XXXX"
};

if(typeof (TDConf) != "undefined"){
	TDConf.sudomain = ("https:" == document.location.protocol) ? "swrap" : "wrap";
	TDConf.host = ".tradedoubler.com/wrap";
	TDConf.containerTagURL = (("https:" == document.location.protocol) ? "https://" : "http://")  + TDConf.sudomain + TDConf.host;

	if (typeof (TDConf.Config) != "undefined") {
		if ($async){

			   var TDAsync = document.createElement('script');
					TDAsync.src = TDConf.containerTagURL  + "?id="+ TDConf.Config.containerTagId;
					TDAsync.async = "yes";
					TDAsync.width = 0;
					TDAsync.height = 0;
			TDAsync.frameBorder = 0;
				document.body.appendChild(TDAsync);
		}
		else{
				document.write(unescape("%3Cscript src='" + TDConf.containerTagURL  + "?id="+ TDConf.Config.containerTagId +" ' type='text/javascript'%3E%3C/script%3E"));
		}
	}
}


</script>

The Product Listing Page CT contrary to the previous one will require some development from the client side. As you can see the client would have to replace the productID, price, currency and product name in the arry variable.
It’s important to fill the value this way:

{id: "PRODUCTID1", price:"20.05", currency:"EUR", name:"PRODUCTNAME1"},

Product pages


The product details page is slightly different from the product listing page, as you can see there are just information related to the product. All variables are not mandatory, the client would have to fill at least: productId, productName, price, category.

Tag to be inserted on product pages (case 3)
============================================

<script type="text/javascript">

		$async = true; // true : Asynchronous script     /     false : Synchronous Script

function getVar(name) {
	get_string = document.location.search;
	return_value = '';
	do {
		name_index = get_string.indexOf(name + '=');
		if(name_index != -1) {
			get_string = get_string.substr(name_index + name.length + 1,
			get_string.length - name_index);
			end_of_value = get_string.indexOf('&');
			if(end_of_value != -1) {
				value = get_string.substr(0, end_of_value);
			} else {
				value = get_string;
			}
			if(return_value == '' || value == '') {
				return_value += value;
			} else {
				return_value += ', ' + value;
			}
		}
	}
	while(name_index != -1) {
		space = return_value.indexOf('+');
	}
	while(space != -1) {
		return_value = return_value.substr(0, space) + ' ' +
		return_value.substr(space + 1, return_value.length);
		space = return_value.indexOf('+');
	}
	return(return_value);
}
function setCookie(name, value, expires, path, domain, secure) {
               var today = new Date();
               today.setTime( today.getTime() );
               if ( expires ) {
                              expires = expires * 1000 * 60 * 60 * 24;
               }
               var expires_date = new Date( today.getTime() + (expires) );
               document.cookie= name + "=" + escape(value) +
               ((expires) ? "; expires=" + expires_date.toGMTString() : "") +
               ((path) ? "; path=" + path : "") +
               ((domain) ? "; domain=" + domain : "") +
               ((secure) ? "; secure" : "");
}
var mytduid = getVar('tduid');

if  (mytduid!='')
{

setCookie('TRADEDOUBLER', mytduid, 365, '/', '.domain.com');
}


var TDConf = TDConf || {};
TDConf.Config = {
	productId: "[product-id]",
	category: "[main-category-name]",
	brand: "[brand]",
	productName: "[product-name]",
	productDescription: "[product-description]",
	price: "[price]",
	currency: "[currency]",
	url: "[click-url]",
	imageUrl: "[url-to-product-image]",
	containerTagId : "XXXX"
};

if(typeof (TDConf) != "undefined"){
	TDConf.sudomain = ("https:" == document.location.protocol) ? "swrap" : "wrap";
	TDConf.host = ".tradedoubler.com/wrap";
	TDConf.containerTagURL = (("https:" == document.location.protocol) ? "https://" : "http://")  + TDConf.sudomain + TDConf.host;

	if (typeof (TDConf.Config) != "undefined") {
		if ($async){

			   var TDAsync = document.createElement('script');
					TDAsync.src = TDConf.containerTagURL  + "?id="+ TDConf.Config.containerTagId;
					TDAsync.async = "yes";
					TDAsync.width = 0;
					TDAsync.height = 0;
			TDAsync.frameBorder = 0;
				document.body.appendChild(TDAsync);
		}
		else{
				document.write(unescape("%3Cscript src='" + TDConf.containerTagURL  + "?id="+ TDConf.Config.containerTagId +" ' type='text/javascript'%3E%3C/script%3E"));
		}
	}
}



</script>

Basket pages


The basket page CT looks like the product listing page but with ‘qty’ variable added to the array variable. This corresponds to the quantity of products of the same type in the basket.

Tag to be inserted on basket pages (case 4)
===========================================



<script type="text/javascript">

		$async = true; // true : Asynchronous script     /     false : Synchronous Script

function getVar(name) {
	get_string = document.location.search;
	return_value = '';
	do {
		name_index = get_string.indexOf(name + '=');
		if(name_index != -1) {
			get_string = get_string.substr(name_index + name.length + 1,
			get_string.length - name_index);
			end_of_value = get_string.indexOf('&');
			if(end_of_value != -1) {
				value = get_string.substr(0, end_of_value);
			} else {
				value = get_string;
			}
			if(return_value == '' || value == '') {
				return_value += value;
			} else {
				return_value += ', ' + value;
			}
		}
	}
	while(name_index != -1) {
		space = return_value.indexOf('+');
	}
	while(space != -1) {
		return_value = return_value.substr(0, space) + ' ' +
		return_value.substr(space + 1, return_value.length);
		space = return_value.indexOf('+');
	}
	return(return_value);
}
function setCookie(name, value, expires, path, domain, secure) {
               var today = new Date();
               today.setTime( today.getTime() );
               if ( expires ) {
                              expires = expires * 1000 * 60 * 60 * 24;
               }
               var expires_date = new Date( today.getTime() + (expires) );
               document.cookie= name + "=" + escape(value) +
               ((expires) ? "; expires=" + expires_date.toGMTString() : "") +
               ((path) ? "; path=" + path : "") +
               ((domain) ? "; domain=" + domain : "") +
               ((secure) ? "; secure" : "");
}
var mytduid = getVar('tduid');

if  (mytduid!='')
{

setCookie('TRADEDOUBLER', mytduid, 365, '/', '.domain.com');
}


var TDConf = TDConf || {};
TDConf.Config = {
  products:[
    {id: "[product-id1]", price:"[price1]", currency:"[currency1]", name:"[product-name1]", qty:"[quantity1]"},
    {id: "[product-id2]", price:"[price2]", currency:"[currency2]", name:"[product-name1]", qty:"[quantity2]"},
    ...
  ],
	containerTagId : "XXXX"
};

if(typeof (TDConf) != "undefined"){
	TDConf.sudomain = ("https:" == document.location.protocol) ? "swrap" : "wrap";
	TDConf.host = ".tradedoubler.com/wrap";
	TDConf.containerTagURL = (("https:" == document.location.protocol) ? "https://" : "http://")  + TDConf.sudomain + TDConf.host;

	if (typeof (TDConf.Config) != "undefined") {
		if ($async){

			   var TDAsync = document.createElement('script');
					TDAsync.src = TDConf.containerTagURL  + "?id="+ TDConf.Config.containerTagId;
					TDAsync.async = "yes";
					TDAsync.width = 0;
					TDAsync.height = 0;
			TDAsync.frameBorder = 0;
				document.body.appendChild(TDAsync);
		}
		else{
				document.write(unescape("%3Cscript src='" + TDConf.containerTagURL  + "?id="+ TDConf.Config.containerTagId +" ' type='text/javascript'%3E%3C/script%3E"));
		}
	}
}





</script>

Registration page


This CT looks like CT for Home page and should be placed on your “sign-up for newsletter page”

Tag to be inserted on newsletter signup page (case 5)
=======================================================================

<script type="text/javascript">

		$async = true; // true : Asynchronous script     /     false : Synchronous Script

function getVar(name) {
	get_string = document.location.search;
	return_value = '';
	do {
		name_index = get_string.indexOf(name + '=');
		if(name_index != -1) {
			get_string = get_string.substr(name_index + name.length + 1,
			get_string.length - name_index);
			end_of_value = get_string.indexOf('&');
			if(end_of_value != -1) {
				value = get_string.substr(0, end_of_value);
			} else {
				value = get_string;
			}
			if(return_value == '' || value == '') {
				return_value += value;
			} else {
				return_value += ', ' + value;
			}
		}
	}
	while(name_index != -1) {
		space = return_value.indexOf('+');
	}
	while(space != -1) {
		return_value = return_value.substr(0, space) + ' ' +
		return_value.substr(space + 1, return_value.length);
		space = return_value.indexOf('+');
	}
	return(return_value);
}
function setCookie(name, value, expires, path, domain, secure) {
               var today = new Date();
               today.setTime( today.getTime() );
               if ( expires ) {
                              expires = expires * 1000 * 60 * 60 * 24;
               }
               var expires_date = new Date( today.getTime() + (expires) );
               document.cookie= name + "=" + escape(value) +
               ((expires) ? "; expires=" + expires_date.toGMTString() : "") +
               ((path) ? "; path=" + path : "") +
               ((domain) ? "; domain=" + domain : "") +
               ((secure) ? "; secure" : "");
}
var mytduid = getVar('tduid');

if  (mytduid!='')
{

setCookie('TRADEDOUBLER', mytduid, 365, '/', '.domain.com');
}


var TDConf = TDConf || {};
TDConf.Config = {
	protocol : document.location.protocol,
	containerTagId : "XXXX"
};

if(typeof (TDConf) != "undefined"){
	TDConf.sudomain = ("https:" == document.location.protocol) ? "swrap" : "wrap";
	TDConf.host = ".tradedoubler.com/wrap";
	TDConf.containerTagURL = (("https:" == document.location.protocol) ? "https://" : "http://")  + TDConf.sudomain + TDConf.host;

	if (typeof (TDConf.Config) != "undefined") {
		if ($async){

			   var TDAsync = document.createElement('script');
					TDAsync.src = TDConf.containerTagURL  + "?id="+ TDConf.Config.containerTagId;
					TDAsync.async = "yes";
					TDAsync.width = 0;
					TDAsync.height = 0;
			TDAsync.frameBorder = 0;
				document.body.appendChild(TDAsync);
		}
		else{
				document.write(unescape("%3Cscript src='" + TDConf.containerTagURL  + "?id="+ TDConf.Config.containerTagId +" ' type='text/javascript'%3E%3C/script%3E"));
		}
	}
}

</script>

Confirmation page

The confirmation page CT is one of the most important because it allows to measure the conversion for partners. In this one the Client would have to fill up the array variable with the content of the sale but also fill up the ‘orderID’, ‘orderValue’ and ‘currency’.

Tag to be inserted on post-purchase page (case 6)
=================================================
<script type="text/javascript">

		$async = true; // true : Asynchronous script     /     false : Synchronous Script

function getCookie(name) {
	var dc = document.cookie;
	var prefix = name + "=";
	var begin = dc.indexOf("; " + prefix);
	if (begin == -1) {
		begin = dc.indexOf(prefix);
		if (begin != 0) return null;
	} else {
		begin += 2;
	}
	var end = document.cookie.indexOf(";", begin);
	if (end == -1) {
		end = dc.length;
	}
	return unescape(dc.substring(begin + prefix.length, end));
}


var TDConf = TDConf || {};
TDConf.Config = {
  products:[
    {id: "[product-id1]", price:"[price1]", currency:"[currency1]", name:"[product-name1]",grpId:"[group-product-id1]", qty:"[quantity1]"},
    {id: "[product-id2]", price:"[price2]", currency:"[currency2]", name:"[product-name1]",grpId:"[group-product-id2]", qty:"[quantity2]"},
    ...
  ],
  orderId: "[orderId]",
  orderValue: "[orderValue]",
  currency: "[currency]",
  containerTagId : "XXXX"
};

if(typeof (TDConf) != "undefined"){
		TDConf.Config.tduid=getCookie("TRADEDOUBLER");
	TDConf.sudomain = ("https:" == document.location.protocol) ? "swrap" : "wrap";
	TDConf.host = ".tradedoubler.com/wrap";
	TDConf.containerTagURL = (("https:" == document.location.protocol) ? "https://" : "http://")  + TDConf.sudomain + TDConf.host;

	if (typeof (TDConf.Config) != "undefined") {
		if ($async){

			   var TDAsync = document.createElement('script');
					TDAsync.src = TDConf.containerTagURL  + "?id="+ TDConf.Config.containerTagId;
					TDAsync.async = "yes";
					TDAsync.width = 0;
					TDAsync.height = 0;
			TDAsync.frameBorder = 0;
				document.body.appendChild(TDAsync);
		}
		else{
				document.write(unescape("%3Cscript src='" + TDConf.containerTagURL  + "?id="+ TDConf.Config.containerTagId +" ' type='text/javascript'%3E%3C/script%3E"));
		}
	}
}

</script>