Search code examples
javascripttestinggoogle-analytics

Google Analytics testing/sandbox environment?


Is there any Google Analytics testing/sandbox environment for testing your JS custom code before putting it to live system?

I don't want to use my real tracking ID to see if everything is correct on my dev. environment, neither I want to put my code untested live...

Is there any techniques or maybe some fake Analytics tracking lib I could use for testing?


Solution

  • I believe it is possible, but you have to tell it to not use the domain when setting the cookie...

    var pageTracker = _gat._getTracker("UA-12345-1");
    pageTracker._setDomainName("none");
    pageTracker._trackPageview();
    

    And you probably have to use a legitimate tracker ID.

    Also, be sure to see Analytics Customizations: Using a Local Server