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

wood1e2

Free Member
May 2, 2007
2,313
174
Leicester
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
 

Fredrik

Free Member
Nov 5, 2015
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.
 
Upvote 0

fisicx

Moderator
Sep 12, 2006
46,680
8
15,376
Aldershot
www.aerin.co.uk
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.
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:
Upvote 0

fisicx

Moderator
Sep 12, 2006
46,680
8
15,376
Aldershot
www.aerin.co.uk
Upvote 0

fisicx

Moderator
Sep 12, 2006
46,680
8
15,376
Aldershot
www.aerin.co.uk
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.
 
  • Like
Reactions: wood1e2
Upvote 0
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.

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.
 
  • Like
Reactions: wood1e2 and fisicx
Upvote 0

Latest Articles