SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Jun 2010
    0 Post(s)
    0 Thread(s)

    Unhappy Google Analytics not working....

    Could someone please look at my code here:

    <script type="text/javascript">
    var _gaq = _gaq || [];
    _gaq.push(['_setAccount', 'UA-33318600-1']);
    _gaq.push(['_setDomainName', '']);

    (function() {
    var ga = document.createElement('**script'); ga.type =
    'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : '
    http://www') + '';
    var s = document.getElementsByTagName(**'script')[0];
    s.parentNode.insertBefore(ga, s);

    I have inserted the Google Analytics tracking code provided to me, copied & pasted directly yet Analytics continually says that the tracking code has not been set-up. I have double checked the UA numbers and they are the ones corresponding to their account.

    What could be the problem?

  2. #2
    Gre aus'm Pott gold trophysilver trophybronze trophy
    Pullo's Avatar
    Join Date
    Jun 2007
    219 Post(s)
    12 Thread(s)

    I have Google Analytics set up on several sites and I just compared your code with mine.
    The only difference I could see, was in the following lines:

    var ga = document.createElement('**script');
    var s = document.getElementsByTagName(**'script')[0];

    On my sites these lines read:

    var ga = document.createElement('script');
    var s = document.getElementsByTagName('script')[0];

    i.e. there is no double asterisk proceeding the word script.

    Other than that, it might be the case that Google Analytics takes a while to start tracking a site.

    I have no idea if this is relevant, but hope it helps anyway.

  3. #3
    Non-Member Dynamic_Systems's Avatar
    Join Date
    Sep 2012
    0 Post(s)
    0 Thread(s)
    In the past we had the following problem in our site <snip>. When the new version was launched, we made a PHP script that was sending us an email each tome somebody enters a page. The email was containing the page's name and visitor's IP. So within one day we were receiving much more emails rather than the number of visitors displayed in Google Analytics. So I don't trust it much.
    Last edited by TechnoBear; Sep 23, 2012 at 04:36. Reason: Unnecessary URL removed.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts