• Resolved Guido

    (@guido07111975)


    Hi,

    Received my latest mail from Google Analytics containing my user stats.
    Notice the new widget preview is counted as well:

    
    /wp-admin/widgets.php?legacy-widget-preview[idBase]=links&legacy-widget-preview[instance][encoded]=YTo3OntzOjY6ImltYWdlcyI7aToxO3M6NDoibmFtZSI7aToxO3M6MTE6ImRlc2NyaXB0aW9uIjtpOjA7czo2OiJyYXRpbmciO2k6MDtzOjc6Im9yZGVyYnkiO3M6NDoibmFtZSI7czo4OiJjYXRlZ29yeSI7aTo0O3M6NToibGltaXQiO2k6LTE7fQ==&legacy-widget-preview[instance][hash]=af01d819bc22ad100aeb4a77eeaa94b4
    

    Have multiple widgets, meaning multiple listings in Google Analytics.

    I have a simple Google tracking code in the head section of my site.

    Is this something I can block? Did found is_preview() condition, but that one is for posts and pages.

    Guido

    • This topic was modified 2 years, 9 months ago by Jan Dembowski. Reason: Moved to Fixing WordPress, this is not an Developing with WordPress topic
Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator bcworkz

    (@bcworkz)

    Hiya Guido!

    Suppressing GA tracking for such requests is a good idea, but I’m unsure of what, if any, WP function would identify such a request. I suppose you could check $_SERVER['REQUEST_URI']?

    I was going to suggest instead filtering out such data within GA itself. That would be fine for your own site, but if this is related to your WP themes/plugins, that would be asking a lot of end users.

    Thread Starter Guido

    (@guido07111975)

    Hi BC!

    It’s always nice “talking” to you.

    It’s a client website and because there are only a few visits each day, those widget previews are in the top 10 of the weekly user stats 😉 When the widget page is being visited that week of course.

    Hopefully WP provides a fix someday. By extending the is_preview() function for example.

    Guido

    Moderator bcworkz

    (@bcworkz)

    Ah, I see. For one particular client I’d definitely look at filtering out preview data from within their GA itself. I’m not a GA expert by any means, so I’m not entirely sure how to that. Its filtering capability seems pretty extensive though. I’ve been able to filter out developer IP data and even referrer spam, so it seems feasible to filter out previews.

    I did find this after a quick search:
    https://bethebean.com/blog/how-to-filter-wordpress-preview-traffic-in-google-analytics/

    Thread Starter Guido

    (@guido07111975)

    Hi BC,

    Thanks for the link, guess that’s the best thing to do. Apparently this is not a new issue, it’s a Customizer thing.

    Ignore the previously mentioned is_preview() function, this has nothing to do with the Customizer preview. Wrong assumption. Found the is_customize_preview() function instead.

    Guido

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Widget preview in Google Analytics stats’ is closed to new replies.