Part 5: Adding Google Analytics tracking to the SWFAddress include

by on May.31, 2009, under ActionScript, Flash, SEO

Dynamic SEO tags for your Flash site using PHP

To include Google Analytics tracking into your deeplinked flash site configure your SWF address like this:

       <script type="text/javascript">
            var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
            document.write(unescape("%3Cscript src='" + gaJsHost + "' type='text/javascript'%3E%3C/script%3E"));
        <script type="text/javascript">
            var pageTracker = _gat._getTracker("UA-XXXXX-1");

        <script type="text/javascript" src="swfobject/swfobject.js"></script>
        <script type="text/javascript" src="swfaddress/swfaddress.js"></script>

Substitute UA-XXXXX-1 with your actual UA number (available in your Google Analytics control panel), make sure you’ve got the var pagTracker set before including the swfobject.js & swfaddress.js files.

Remove any original Google Analytics code you have in the page and you should be set.

In your Google Analytics control panel you will now see your deeplinks being tracked such as /#/page.

No comments for this entry yet...

Leave a Reply

You must be logged in to post a comment.

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...