How can Google Analytics track 'Send Test Traffic' if Analytics code is not inserted on website?

Discussion in 'Ecommerce Forum' started by wood1e2, Jul 11, 2019.

  1. wood1e2

    wood1e2 UKBF Ace Free Member

    2,091 163
    Hi

    I am working on a website for a client see here: https://www.screencast.com/t/Sc6aehKhl and they have redirected from a previous domain. ON this domain was the Google Analytics tracking code.

    I have deleted this, and the website! Yet still I am able to view 'Send Test Traffic' in real-time report see here: https://www.screencast.com/t/FSPazo5PX3

    And here: https://www.screencast.com/t/y24h55xId

    How is this possible? I have scanned the site and I cannot find analytics coding anywhere... I am obviously missing something. It is driving me bonkers!

    Cheers
     
    Posted: Jul 11, 2019 By: wood1e2 Member since: May 2, 2007
    #1
  2. fisicx

    fisicx It's Major Clanger! Staff Member

    30,371 8,923
    On the homepage. Lines 640 to 649
     
    Posted: Jul 11, 2019 By: fisicx Member since: Sep 12, 2006
    #2
  3. Paulo1Chop

    Paulo1Chop UKBF Contributor Free Member

    53 3
    Me Google. Me have smoke and mirrors a plenty!
     
    Posted: Jul 12, 2019 By: Paulo1Chop Member since: Jul 12, 2019
    #3
  4. wood1e2

    wood1e2 UKBF Ace Free Member

    2,091 163
    Where? Line 640? is PrettyPhoto CSS? Nothing there to do with Analytics... although that may be my problem... I have been looking at this so much maybe I am missing the blooming obvious.
     
    Posted: Jul 12, 2019 By: wood1e2 Member since: May 2, 2007
    #4
  5. wood1e2

    wood1e2 UKBF Ace Free Member

    2,091 163
    Very true :)
     
    Posted: Jul 12, 2019 By: wood1e2 Member since: May 2, 2007
    #5
  6. Fredrik

    Fredrik UKBF Newcomer Full Member

    28 1
    Hey @wood1e2,
    Just had a look at the website and on the homepage I can see GA code, (just search for "ga(" ) in the source code in Chrome and you can see the pageview tag...

    You probably have a wp plugin that sets it... ps would strongly recommend that you use tag manager instead of Google Analytics directly.
     
    Posted: Jul 12, 2019 By: Fredrik Member since: Nov 5, 2015
    #6
  7. fisicx

    fisicx It's Major Clanger! Staff Member

    30,371 8,923
    I see this:
    Code:
    <script>
        jQuery(document).ready(function () {
            jQuery.post('https://ghmcare.co.uk?ga_action=googleanalytics_get_script', {action: 'googleanalytics_get_script'}, function(response) {
                var s = document.createElement("script");
                s.type = "text/javascript";
                s.innerHTML = response;
                jQuery("head").append(s);
            });
        });
    </script>
    The Pretty Photo CSS is on line 660.
     
    Last edited: Jul 13, 2019
    Posted: Jul 13, 2019 By: fisicx Member since: Sep 12, 2006
    #7
  8. Glen Wheeler

    Glen Wheeler UKBF Newcomer Free Member

    11 4
    I see what Fisicx see's. This must be sat in your header.php somewhere if you're using Wordpress. In a header partial if its static.
     
    Posted: Jul 13, 2019 By: Glen Wheeler Member since: Dec 6, 2016
    #8
  9. fisicx

    fisicx It's Major Clanger! Staff Member

    30,371 8,923
    It's been embedded in the footer on the ghm site - which isn't the best place for GA.
     
    Posted: Jul 13, 2019 By: fisicx Member since: Sep 12, 2006
    #9
  10. wood1e2

    wood1e2 UKBF Ace Free Member

    2,091 163
    Hi

    I can see this now, couldn't see it before as I was logged in as Admin!! Bonkers, just couldn't see the wood for the trees!!

    Thanks @fisicx & @Glen Wheeler
     
    Posted: Jul 13, 2019 By: wood1e2 Member since: May 2, 2007
    #10
  11. Glen Wheeler

    Glen Wheeler UKBF Newcomer Free Member

    11 4
    Yeah, Google Advises header, but it these levels it's not too important really. It also depends hopw its been implement, static files or is it being fired in via a plugin.
     
    Posted: Jul 13, 2019 By: Glen Wheeler Member since: Dec 6, 2016
    #11
  12. fisicx

    fisicx It's Major Clanger! Staff Member

    30,371 8,923
    It’s not so much the method of delivery but more to do with how JS is enqueued. The site has a shed load of scripts which means GA won’t even get a look in until too late. People could have bounced and GA would never know.
     
    Posted: Jul 13, 2019 By: fisicx Member since: Sep 12, 2006
    #12
  13. Glen Wheeler

    Glen Wheeler UKBF Newcomer Free Member

    11 4
    Hard to control really if theres a bunch of plugins being loaded in to the header. With Wordpress people generally do not think about the consequences of inserting plugins. These would generally throw a bunch of JS in and as the DOM's loaded GA could appear way down the list.

    I guess all you can do in this scenario is do an audit and make sure GA is at top level when loading scripts using the enqueue method from the functions file. Performance in my opinion is more important than anything else so getting rid of redundant or unwanted scripts its key.
     
    Posted: Jul 13, 2019 By: Glen Wheeler Member since: Dec 6, 2016
    #13