<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>The Morphic Group &#187; ClickTag</title>
	<atom:link href="http://www.themorphicgroup.com/blog/tag/clicktag/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.themorphicgroup.com/blog</link>
	<description></description>
	<lastBuildDate>Mon, 22 Feb 2010 18:20:39 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Web Ads with ClickTags</title>
		<link>http://www.themorphicgroup.com/blog/2009/04/10/web-ads-with-clicktags/</link>
		<comments>http://www.themorphicgroup.com/blog/2009/04/10/web-ads-with-clicktags/#comments</comments>
		<pubDate>Fri, 10 Apr 2009 20:54:47 +0000</pubDate>
		<dc:creator>Unknown Morphician</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[ClickTag]]></category>
		<category><![CDATA[flash cs3]]></category>
		<category><![CDATA[Web Ad]]></category>

		<guid isPermaLink="false">http://www.themorphicgroup.com/blog/?p=74</guid>
		<description><![CDATA[When creating web ads for third party companies, you maybe asked to add a clickTag, a reference to an external variable. The variable is passed from within the html Object/Embed tags via query string or FlashVar parameter. This allows an ad manager to track the click-through of the Flash SWF. Usually, the ad manager would [...]]]></description>
			<content:encoded><![CDATA[<p>When creating web ads for third party companies, you maybe asked to add a clickTag,<br />
a reference to an external variable. The variable is passed from within the html Object/Embed tags via query string or FlashVar parameter. This allows an ad manager to track the click-through of the<br />
Flash SWF. Usually, the ad manager would create an ad server value with the target url address. As the developer, you need to reference this variable from within your project.</p>
<p>Let's walk though a solution for building a Flash ad (in AS 3.0) with a clickTag. <em>Note: In most cases, ad companies and developers are required to use AS 2.0. There are plenty of great articles that discuss this implementation. There is an adobe article that is widely used <a href="http://www.adobe.com/resources/richmedia/tracking/designers_guide/" target="_new">Designer's Guide: Building Macromedia Flash Banners with Tracking Capabilities</a>. This article will not discuss this how to create ads with clickTags using AS 2.0 .</em></p>
<p>The ad manager will also want to prevent the click-through target from being blocked by any<br />
popup blockers. This usually the case with certain web browsers like IE 7.0+. Note: At this<br />
time there is a new Flash player version out (version 11). I don't know if this issue is fixed.</p>
<p style="margin-bottom: 0in;">So we have three requirements …</p>
<ul>
<li>
<p style="margin-bottom: 0in;">Get a reference to the clickTag 	variable</p>
</li>
<li>
<p style="margin-bottom: 0in;">Build your web ad with AS 3.0</p>
</li>
<li>
<p style="margin-bottom: 0in;">Handle the issue with the Popup 	Blockers</p>
</li>
</ul>
<p>Here is an example of code for satisfying these requirements.</p>
<p>html embed parameter<br />
...<br />
&lt;param name="FlashVars" value="clickTag=http://www.adserver.com/target.php?track=1123" /&gt;<br />
...</p>
<p>actionscript code</p>
<pre><code>
package
{

import flash.external.ExternalInterface;
import flash.net.navigateToURL;
import flash.net.URLRequest;

public class Main extends MovieClip
{
  private var paramList:Object;
  public var clickTag:String = ""; 

  function Main()
  {
    paramList = this.root.loaderInfo.parameters;

    if(paramList["clickTag"] != null)
    {
        clickTag = paramList["clickTag"];
    }

    clickTagBtn.addEventListener(MouseEvent.CLICK, onClick);

  } 

  function onClick( event:MouseEvent ):void
  {
    if( clickTag != ""  )
    {
      var req:URLRequest = new URLRequest(clickTag);

      if ( !ExternalInterface.available )
      {
        navigateToURL(req, "_blank");
      }
      else
      {
        var strUserAgent:String =
          String(ExternalInterface.call(
		"function() {return navigator.userAgent;}"
		)).toLowerCase();

        if ( strUserAgent.indexOf("firefox") != -1 )
        {
          ExternalInterface.call( "window.open", req.url, "_blank" );
        }
        else
        {
          if( strUserAgent.indexOf("msie") != -1 &amp;&amp;
            uint(strUserAgent.substr(strUserAgent.indexOf("msie") + 5, 3)) &gt;= 7 )
          {
            ExternalInterface.call("window.open", req.url, "_top");
          }
          else
          {
            navigateToURL(req, "_top");
          }
        }
      }
    }

  }

}

}

</code></pre>
<p>I am assuming that you are using Flash CS 3 or greater and that Main is your document class for your fla project.</p>
<p style="margin-bottom: 0in;">First I need to get the get the value of the clickTag.</p>
<ul>
<li>
<p style="margin-bottom: 0in;">Reference the 	loaderInfo.parameters as an Object and then reference the key value 	of clickTag.</p>
</li>
<li>
<p style="margin-bottom: 0in;">The character's case is very 	important. Letter case is important, otherwise you won't be able to 	reference this value.</p>
</li>
</ul>
<p style="margin-bottom: 0in;">
<p style="margin-bottom: 0in;">The key to handling the issue with popup blockers is to use a little javascript, with the help of External interface.</p>
<ul>
<li>
<p style="margin-bottom: 0in;">If ExternalInterface is not available, use 	NavigateToUrl directly.</p>
</li>
<li>
<p style="margin-bottom: 0in;">Get the userAgent (browser) 	information via javascript. I use this info to handle browser 	different quirks.</p>
</li>
<li>
<p style="margin-bottom: 0in;">Call the javascript method 	window.open to open the link specified by the clickTag value.  It is 	absolutely necessary to enable AllowScripting for “sameDomain” 	or “always” . Otherwise a security sandbox error will display.</p>
</li>
</ul>
<p>This solution should get you out of most jams in regards to ClickTag functionality using AS 3.0 .</p>
]]></content:encoded>
			<wfw:commentRss>http://www.themorphicgroup.com/blog/2009/04/10/web-ads-with-clicktags/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
