Part 5: Adding Google Analytics tracking to the SWFAddress include

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.

Leave a Reply

Your email address will not be published. Required fields are marked *