Homepage

Adding Google Analytics to your Directory

October 4th, 2007

I decided to add Google Analytics to Lobo Links so I could track day to day failure or success. It is too soon to tell which, lol.

The New Google Analytics

Google Analytics has been re-designed to help you learn even more about where your visitors come from and how they interact with your site.
Discover. Share. Act.

The new Google Analytics makes it easy to improve your results online. Write better ads, strengthen your marketing initiatives, and create higher-converting websites. Google Analytics is free to all advertisers, publishers, and site owners.


If you do not have a Google account you can get one by signing up. During the signup process it will ask you to enter a domain name. It is fairly straight forward.

One of the last screens is a snipplet of javascript you must add to your website in order for Google to track information. Should look something like this
[js]
[/js]

This code needs to be placed in your current themes footer.tpl just before the closing body tag.

To add javascript to a smarty template. You must use what is called a literal. This is most important.

{literal}
{literal} tags allow a block of data to be taken literally. This is typically used around javascript or stylesheet blocks where curly braces would interfere with the template delimiter syntax. Anything within {literal}{/literal} tags is not interpreted, but displayed as-is.

So open footer.tpl in your favorite editor and find
[smarty][/smarty]

On a new line above add
[smarty]{literal}
{/literal}[/smarty]

Be sure to replace my analytics code with yours and now you are ready to finish the Google Analytics setup.

Posted in Directory Owner Tips