1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Tracking one domain with multiple analythas aics accounts possibe?

Discussion in 'Black Hat SEO' started by Trevor J, Oct 23, 2013.

  1. Trevor J

    Trevor J Junior Member

    Joined:
    Apr 4, 2013
    Messages:
    110
    Likes Received:
    31
    Is it possible to have more than one analytics script on a website associated with more than one account? AKA a client already has analytics installed for them selves, but I want to add my script also to my agency account without removing theirs or having to get an invite from them.
     
  2. Grizzy

    Grizzy Senior Member

    Joined:
    Nov 11, 2008
    Messages:
    919
    Likes Received:
    999
    Yes, you can instantiate a new/separate GA object by prefixing a unique namespace to your GA methods.

    Example:

    _gaq.push(['thirdParty._setAccount', 'UA-XXXXXXXX-X']);
    _gaq.push(['thirdParty._setDomainName', document.location.host]);
    etc...
     
    • Thanks Thanks x 1
  3. Trevor J

    Trevor J Junior Member

    Joined:
    Apr 4, 2013
    Messages:
    110
    Likes Received:
    31
    Would it not work if I just dropped 2 scripts in from Google? Do I have to mod the scripts then?
     
  4. Grizzy

    Grizzy Senior Member

    Joined:
    Nov 11, 2008
    Messages:
    919
    Likes Received:
    999
    The standard ga.js script should only need to be loaded one time.

    Sounds like you should just let your client load the GA script and then you can call your custom _gaq methods wherever you want.

    In my scenario where I want to providing tracking for my own third party scripts that happen to sit on other people's websites, I just assume that they will load the script themselves (even though sometimes they won't be using GA at all), but before I call my custom _gaq methods (and usually after a small timeout has passed), I check for the presence of that ga.js file. If the file is not present I will dynamically load it myself. :cool: