Site logo

[Support request] Tracking Adblockers traffic

Home Forums Support [Support request] Tracking Adblockers traffic

Home Forums Support Tracking Adblockers traffic

  • This topic has 3 replies, 2 voices, and was last updated 4 years ago by David.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #2153980
    Patricia

    Hi guys! Hope you all had a great weekend!

    I am trying to track adblocker traffic, and I have found this code down here. My question is, how do I add this to Generatepress theme, and would like to ask if you by any means know a quick and safe way to do this? Thank you! 🙂

    if(typeof adsbygoogle !== \”undefined\”) {
    window.addEventListener(\’load\’, function() {
    if(typeof ga !== \”undefined\”) {
    if(typeof adsbygoogle.loaded === \”undefined\”) {
    ga(\’send\’, \’event\’, \’AdSense\’, \’Ads blocked\’, { \”nonInteraction\”: 1 });
    } else {
    ga(\’send\’, \’event\’, \’AdSense\’, \’Ads not blocked\’, { \”nonInteraction\”: 1 });
    }
    }
    }, false);
    }

    #2154006
    David
    Staff
    Customer Support

    Hi there,

    it looks like a script.
    So you can try:

    1. Create a new Hook Element.
    https://docs.generatepress.com/article/hooks-element-overview/
    2. In the Hook Element add your code wrapped in <script> tags ie.

    <script>
       add the code in here
    </script>
    

    3. Set the Hook to wp_header
    4. Set the Display rule to where you want it applied. eg. Entire Site

    #2154035
    Patricia

    thank you so much! 🙂 have a great week!

    #2154225
    David
    Staff
    Customer Support

    You’re welcome – you too 🙂

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.