Help Center Manage Your Account Banner, Richmedia, and Text Ads

How do I track click for Flash/SWF ads?

Flash ads (SWF files) should not use a static link for the click button, it should use clickTAG parameter, which is the industry-standard for click tracking. clickTAG is used across all ad servers to track clicks of Flash/SWF ads. Our ad server will ask for the actual click URL when you create the SWF ad in your account.

Conversion

The original ActionScript 2 code for the button instance may look something like this:
on (release) {
  getURL("https://www.example.com/","_top");
}

After the conversion for click tracking, it should look like this:

on (release) {
  if (_root.clickTAG.substr(0,4) == "http") {
    getURL(_root.clickTAG,_root.TargetAS);
  }
}

For ActionScript 3, MyClickButton is the name of the button instance and the code should look like this:

MyClickButton.addEventListener(
  MouseEvent.CLICK,
  function():void {
    if (root.loaderInfo.parameters.clickTAG.substr(0,4) == "http") {
      navigateToURL(
        new URLRequest(root.loaderInfo.parameters.clickTAG),
        root.loaderInfo.parameters.TargetAS
      );
    }
  }
);
If you would like to know more technical details, please review the official instructions from Adobe Flash. For greater compatibility, our system uses "_root.clickTAG" instead of "clickTAG". Because Flash ads can be served within IFRAMEs, it's best to use target _top or _blank for getURL() function. For security, your code must check for a valid URL instead of allowing a possible malicious JavaScript code.

Sample Code

You can view this tutorial to create a SWF ad with clickTAG tracking from scratch. Or you can download these sample Macromedia .FLA files to compare:
  • Original files with a fixed URL and without click tracking:
    sample.fla (SWF: sample.swf)
  • After conversion, the files use clickTAG parameter for dynamic click tracking:
    sample-clickTAG.fla (SWF: sample-clickTAG.swf)
  • Also, please use this template to manually convert to clickTAG if our system failed to convert your SWF file automatically.

Troubleshoot and Test a SWF file for clickTAG

It is recommended to test all Flash ads for click tracking via clickTAG before allowing it to display online. Learn More

Other Articles in Banner, Richmedia, and Text Ads

Information about different ad formats, dimension, sizes, and specifications.

Cannot find an answer for your question? Ask our Customer Care team

Related