Clicktag specifications for flash creatives

A flash file (.swf) uploaded and delivered through Smart AdServer should use a clicktag for clickable items. Clickthrough URLs should not be hard coded in the flash file.

With a clicktag, the clickthrough URL (destination URL) can be assigned to the clicktag dynamically. This assignment happens, when campaign managers upload the flash creative in Smart AdServer's system.

Using the clicktag is necessary to enable counting (and reporting) of clicks by Smart AdServer's system.

ActionScript 2

In ActionScript 2, use the following code

on (release) {
getURL(_root.clicktag, _root.target);
}

In case of systems using UTF-8 characters, clicktags in flash files must be implemented as follows:

on (release) {
// Will not use the default encoding (which is Unicode) but takes the one from the current page
System.useCodepage = true;
getURL(_root.clicktag, _root.target);
// Will use the default encoding (which is Unicode). This line is not really necessary if the rest of the code is UTF-8 compliant.
System.useCodepage = false;
}

ActionScript 3

In ActionScript 3, use the following code:

import flash.external.ExternalInterface;
import flash.net.URLRequest;
import flash.net.navigateToURL;
btn_click.mouseChildren = false;
btn_click.buttonMode = true;
btn_click.addEventListener(MouseEvent.CLICK,click);
var target = root.loaderInfo.parameters.target;
var clicktag = root.loaderInfo.parameters.clicktag;
function click(e:MouseEvent)
{
var browserName:String = getBrowserName();
if (browserName == "IE")
{
ExternalInterface.call("function setWMWindow() {window.open('"+ clicktag + "');}");
}
else
{
navigateToURL(new URLRequest(clicktag), target);
}
}
function getBrowserName():String
{
var browser:String;
try
{
var browserAgent:String = ExternalInterface.call("function getBrowser(){return navigator.userAgent;}");
}
catch (error:Error)
{
trace(error);
return 'Undefined';
}
if (browserAgent.indexOf("Firefox") >= 0)
{
browser = "Firefox";
}
else if (browserAgent.indexOf("Safari") >= 0)
{
browser = "Safari";
}
else if (browserAgent.indexOf("MSIE") >= 0)
{
browser = "IE";
}
else if (browserAgent.indexOf("Opera") >= 0)
{
browser = "Opera";
}
else
{
browser = "Undefined";
}
return browser;
}

Templates for download

Download the flash templates below. These include the ActionScript code and symbols required for the clicktag mechanism.

Was this article helpful?
0 out of 0 found this helpful
Powered by Zendesk