• Resolved chrisk200

    (@chrisk200)


    Could Site Kit automatically deactivate the Google script when interacting with the site as WordPress admin (or other given roles like editor maybe based on an options).
    On sites with moderate traffic, when working intensively on editing pages as WordPress administrator or editor, counting the pages viewed introduce a bias in the Google stats.
    I know it is possible to exclude some IP addresses from the stats in Google analytics but if you do not have a fixed IP address, it is of no use for the above purpose.
    Chris

Viewing 15 replies - 1 through 15 (of 18 total)
  • Plugin Support James Osborne

    (@jamesosborne)

    @chrisk200 Thanks for the feedback. This feature has been implemented into the plugin as per the following GitHub issue:
    https://github.com/google/site-kit-wp/issues/88

    You will see the option when visiting the Settings > Connected Services > Analytics tab.

    Let me know if that’s not working for you and I’d be happy to take a look.

    Thread Starter chrisk200

    (@chrisk200)

    A precision:

    In the Site Kit settings, I well have
    Excluded from Analytics: Logged-in users

    But despite this setting I see the pages I open (logged as WordPress admin) listed in the Realtime Overwiew of Google Analytics.
    Chris

    Thread Starter chrisk200

    (@chrisk200)

    Thanks James, our posts have crossed each others.
    Yes I well have the setting you mentioned:
    Excluded from Analytics: Logged-in users

    Plugin Support James Osborne

    (@jamesosborne)

    @chrisk200 Can you see your tracking ID when you check the source code of your website (right click > “View page source”)? Please inform me if you see any “UA-” reference in the source code of your homepage.

    If you want to share your site URL I can also check and see if I can notice anything from my side.

    Thread Starter chrisk200

    (@chrisk200)

    @jamesosborne
    In a page displayed when logged as WordPress Admin (that includes the Site Kit icon in the WordPress bar at the top of the screen) that appears in the Google Analytics Real time report, I can see it in 2 different script blocs mentioning the Tracking ID:

    A first one:
    —————————————–

    <script type='text/javascript'>
    /*googlesitekit*/ ( typeof URL === 'function') || document.write( '<script src="https:/
    ..."trackingID":"13-XXXXXXXXX-3"},
    /plugins\/google-site-kit\/dist\/assets\/js\/","editmodule":null}
    </script>

    —————————————–

    and a second one
    —————————————–

    <script type='text/javascript'>
    window._googlesitekitBase = {"homeURL":"https:\/\/w
    ...
    site_id=xxxxxxxxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxx.apps.sitekit.withgoogle.com","trackingID":"UA-13-XXXXXXXXX-3"},
    /plugins\/google-site-kit\/dist"}                                                                                                  
    </script>

    —————————————–

    And I also have the Property ID mentioned in another script in the middle of the 2 above scripts:
    —————————————–

    <script type='text/javascript'>
    window._googlesitekitBase = {"homeURL":".....apps.sitekit.withgoogle.com","trackingID":"UA-13XXXXXX-3"}
    </script>

    —————————————–

    and in the <Head>:
    —————————————–

    meta name="generator" content="Site Kit by Google 1.2.0" /><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" /> 
    <script>( function( w, d, s, l, i ) {
    				w[l] = w[l] || [];
    				w[l].push( {'gtm.start': new Date().getTime(), event: 'gtm.js'} );
    				var f = d.getElementsByTagName( s )[0],
    					j = d.createElement( s ), dl = l != 'dataLayer' ? '&l=' + l : '';
    				j.async = true;
    				j.src = 'https://www.googletagmanager.com/gtm.js?id=' + i + dl;
    				f.parentNode.insertBefore( j, f );
    			} )( window, document, 'script', 'dataLayer', 'GTM-MGXXXX8' );
    		</script>

    —————————————–

    Now, on the live page seen as a visitor, (thatalso appears in the Google Analytics Real time report).

    I also have the
    <script>( function( w, d, s, l, i ) {....
    in the <head>

    But the Tracking ID is not present
    Instead I have the property ID:

    <script type='text/javascript'>/* <![CDATA[ */ var et_core_api_spam_recaptcha = {"site_key":"","page_action":{"action":"www.mysite.com"}}; /* ]]> */</script> <script type='text/javascript' src='https://www.googletagmanager.com/gtag/js?id=UA-11XXXXXXX-1' async></script> <script type='text/javascript'>window.dataLayer = window.dataLayer || [];function gtag(){dataLayer.push(arguments);}gtag('js', new Date());
    gtag('config', 'UA-11XXXXXXX-1', {"useAmpClientId":true,"anonymize_ip":true} );</script>
    Thread Starter chrisk200

    (@chrisk200)

    @jamesosborne

    Additional to the above post, I tried deactivating Site Kit and was able to check the pages I opened (logged as WordPress admin) do not appear anymore in the Google Analytics Realtime Overview (and this was of course true for pages viewed by ordinary visitors).

    Then I reactivated Site Kit and was back to the initial situation (pages I opened (logged as WordPress admin appearing in the Google Analytics Realtime).

    So it definitely seems that the setting
    Excluded from Analytics: Logged-in users
    does not work / is ignored.

    Site Kit is connected to
    Search console
    Analytics
    PageSpeed
    Tag Manager
    All have green status

    @chrisk200 thanks so much for this information. Just to confirm:

    1) You’re seeing admin pages on the Real Time Reports (Overview) section on the Analytics platform and not in Site Kit’s reporting? Do these admin pages appear in other reports at Google Analytics?

    Providing any screenshots would be great to confirm the behavior.

    2) While it looks to be the case, are you using Site Kit to insert the Analytics snippet on the site (only)? I see you might be using Google Tag Manager, but I’m not sure if you have Analytics connected on that platform additionally (should choose one method).

    3) Do you also have the option to Anonymize IP addresses toggled on in Site Kit?

    Thanks!

    Thread Starter chrisk200

    (@chrisk200)

    @reneesoffice
    Thanks for your reply.
    My answers to your point 1, 2 and 3 below:

    1. the only issue I noticed is that I’m seing pages displayed while I’m logged as admin WordPress in the Analytics Report Real Time (Overview).
    Theses pages are pages of the web site I’m working on (not WordPress admin pages), displayed for testing purpose.
    Since I’m currently logged in WordPress as the admin / editor of the site, I understand they should not be tracked based on the Site Kit setting:
    Excluded from Analytics: Logged-in users
    + I guess that if google displays them in the Realtime report, they are also added to the google stats.

    2. If I understand correctly, you mean that in the Site Kit settings, Analytics and Tag Manager must not be connected simultaneously? One method or the other should be selected but not both? (I connected both).
    I have some settings related to Google Ads managed through Tag Manager, this is the reason why I checked it.
    In case only one must be selected which one to chose. Analytics or Tag Manager?
    For information:
    Analytics account is linked to google Ads account and Search Console account
    Tag Manager account is linked to Analytics account

    3) Yes, the option to Anonymize IP addresses is toggled on in Site Kit

    @chrisk200 thank you for the reply!

    1) Thanks for clarifying. I’m testing a few scenarios to try to get what you experience. Does a particular content type (page or post) get tracked in the settings when you view it as an admin? Do you persistently see the top admin bar on the pages that are tracked while logged in?

    2) Let me clarify: you can definitely use Analytics and Tag Manager together. Tag Manager provides a Google Analytics tag to insert into its containers. If you have this configured then, you should choose between using this connection to Analytics or having Site Kit insert the snippet directly into the source code of the site. (Site Kit currently cannot detect the Analytics tag integrated into Tag Manager)

    Just to rule out where the tracking is coming from, I was wondering if you had the Google Analytics tag inside your Tag Manager container?

    3) Thanks for the confirmation!

    Thread Starter chrisk200

    (@chrisk200)

    @reneesoffice
    Thanks for your reply.
    My answers to your point 1 and 2 below + additional information:

    1. All web site pages displayed in the browser when I’m logged get tracked in the real time overview.
    As soon as I open one, I can se the real time overview tracking it.
    I well see the graph increasing by one and the correct URL reported in the report.
    I well see the admin bar in the pages being reported in the real time overview.

    Digging this issue a little bit deeper, it is even worse than this, since pages being edited are also tracked!!!
    Example of a given url tracked when editing a page:
    /?et_pb_preview=true&et_p…preview-1580293997786-537

    2. Yes I have the Google Analytics tag in the Tag Manager container
    I can see it when editing the container in Tag Manager: “Google Analytics: Universal Analytics” along with other Tags.

    Additional information:

    If I use the Google Tag assistant, it shows (on all pages) 4 tags:
    1. Global site tag( gtag.js) (Green)
    UA-117******-1

    2. Google Ads Remarketing Tag (Green)
    75xxxxxx4

    3. Google Analytics (Yellow because “mentioned 2 times”)
    UA-117******-1

    4. Google Tag Manager
    GTM-MGxxxxx

    So this means I do not need to connect Site Kit to Analytics?
    Let’s Try. In site Kit I configure:
    Analytics Code Snippet: Snippet is not inserted
    I clear the cache and retry: still, all web site pages displayed in the browser when I’m logged as admin get tracked in the real time overview.

    So now let’s try putting Back the Analytics snippet in Site Kit and configuring Tag Manager as follows in Site Kit:
    Tag Manager Code Snippet: Snippet is not inserted
    I clear the cache and retry: This time pages being displayed or edited when logged as admin are not reported in the Analytics real time overview anymore.
    And pages browsed by visitors are well reported.
    So this is better.

    But now the question is: Does Google Tag Manager still works?
    If I use the Google Tag assistant, it now shows (on all pages) only 2 tags:
    1. Global site tag( gtag.js)
    2. Google Analytics
    With the same UA-117******-1 code

    On a side note, In GTM I have Tags configured only on some pages.
    The info displayed in Google Tag assistant is the same for these page as for other pages of the site. (in both cases, with (2 tags) and without (4 tags) Tag Manager)

    So here no Site Kit option combination is OK:

    Option 1 – Analytics + Tag Manager:
    All pages getting tracked when viewing them as a logged user (including pages being edited!).

    Option 2 – Analytics only:
    2 Missing Tags

    Option 3 – Tag Manager Only:
    No Analytics tracking

    Question:
    Should I remove The Google Analytics Tag from the Tag Manager container?
    If yes, any side effect to expect?

    Sorry for this long post.
    But this stuff is really not so easy to swallow.

    @chrisk200 no problem at all! Super helpful to have these details. I was able to replicate some of the behavior you mentioned.

    It appears the Analytics Tag within Google Tag Manager is tracking these pages. Site Kit just installs your Google Tag Manager container code currently. Site Kit does not modify the tags in your container or their tracking behavior, so the toggle options in Site Kit (logged-in user, etc.) would not apply to Google Tag Manager (or its tags) at this time.

    With that said, I will check with the team regarding this behavior where the Tag Manager container is placed/ tracking as it seems to be within previews of drafts as well.

    You mentioned that you experienced tracking when editing. I didn’t experience this with a default theme. Could you tell me which theme you’re using?

    Should I remove The Google Analytics Tag from the Tag Manager container?
    If yes, any side effect to expect?

    Since our support is specific to Site Kit, you would need to confer with the Tag Manager support channels for more information regarding this especially if you’re using it in conjunction with Google Ads (it may depend on your particular configuration).

    I’ll share your use case to get more insight and we’ll follow up. Thanks for reaching out about this!

    Thread Starter chrisk200

    (@chrisk200)

    @reneesoffice
    Thanks for your replies

    Regarding:
    “You mentioned that you experienced tracking when editing. I didn’t experience this with a default theme. Could you tell me which theme you’re using?”

    This site uses the Divi theme (latest version).

    It also uses the Yoast the SEO plugin (but not to insert Google code snippets)
    and a couple of other well known plugins like Redirection, Conditional Menus, Create and Assign Categories to Page, Admin Column Pro and a cache plugin, WP Rocket, but that is not implied (not active) on pages displayed or edited by logged users. As far as I can see, nothing that could interfere with Google tracking.

    IMO, Site Kit should provide the option not to insert the Google Tag snippet for logged users (like it does for Analytics).
    Indeed, even if I remove Analytics from the Tag Manager Container, the Tag Manager snippet will still be inserted for no reasons in pages displayed or edited by logged users.

    For now on, I deactivated Site Kit and I am back to the initial solution I was using before to insert the 2 Google Tag Manager snippets taken from the Google Tag Manager “Install Google Tag Manager” page.
    There is one snippet to put in the head and another snippet to put at the top of the body.
    I reactivated a plugin enabling to insert these snippets in all pages and that allows not to insert given snippets based on roles. So for roles like Admin, Author etc. the snippets are not inserted.
    I tested this and all works as expected. no tracking for logged users and tracking OK for visitors

    Using the Tag assistant, I well see 3 tags on my pages (when accessing them as a visitor):
    1. Google Ads Remarketing Tag (Green)
    75xxxxxx4

    2. Google Analytics
    UA-117******-1

    3. Google Tag Manager
    GTM-MGxxxxx

    Once I validated this configuration, I realized that I may still benefit of the Site Kit Dashboard if I reactivated Site Kit and configured it not to insert the Analytics and Tag Manager Snippets. I gave it a try and it was OK.
    So now, I have the Site Kit Dashboard and Site kit features to view pages Google data etc. available without the hassle of Site Kit issues related to Analytics and Tag Manager snippet insertions / management for logged users.

    If I’m positively impressed by your prompt support (thanks again), I must admit that I’m surprised that a plugin provided by Google themselves is able to create such a mess and does not even self-detect possible bad configuration issues like inserting a second time the Analytics snippet if Analytics is included in Google Tag Manager.
    Particularly since the things causing issues seem to be so basic to implement (inserting code snippets in the right places, checking that there is no snippets redundancy).
    I hope things will get better in a near future.
    I’ll be happy to test additional suggestions or updates if/when you have some.

    Chris

    @chrisk200 just a quick update that we were able to discuss your case with the team and they are exploring options to prevent this. I’ll update the thread with more details when I have them. Again, appreciate you raising a topic and sharing your feedback.

    Thread Starter chrisk200

    (@chrisk200)

    Thanks for the info Renee.
    Chris

    @chrisk200 I’m following up on your topic to provide some updates. In version 1.5.0, we released the fix mentioned above that excludes tracking of logged-in users when this option is toggled on in the Site Kit settings and when the Analytics tag in Tag Manager is configured specifically.

    If you have an opportunity to check if this in particular is resolved on your side that would great. You will still see the Tag Manager code, but there is special script that excludes Analytics tracking (<script type="text/javascript">window["_gaUserPrefs"] = { ioo : function() { return true; } }</script>)

    We are in the process of scoping out further work on improving the detection abilities of the Analytics and Tag Manager implementations. We still advise choosing either inserting Site Kit’s Analytics snippet or Tag Manager’s for GA Tracking. Using another plugin for Analytics tracking is also just fine as you have configured.

    Your feedback has been super valuable. Thank you.

Viewing 15 replies - 1 through 15 (of 18 total)
  • The topic ‘Suggestion: don’t count pages viewed when logged as WordPress Admin’ is closed to new replies.