Support » Plugin: AMP » Google analytics issue after switching to AMP plugin

  • Resolved jorgitobg

    (@jorgitobg)


    Hi,

    This last sunday I switch AMP plugin to yours and im so happy, but after changing AMP pages urls from /amp/ to ?amp and all other changes on the template google analytics are not gathering data right.

    Im reading the realtime data from google analytics, ezoic and my own hosting presslabs…. my hosting and ezoic shows almost 40% more pageviews than google analytics since this past sunday. Before this day (plugin switch) the analytics were working fine.

    I tried to debug those last days try everything I thouth can help:

    1) Tried diferent googleanalytics configuration (universal, gtag, etc), also tried with google tag manager configuration
    2) Tried to change all triggers names to avoid some triggers problem.
    3) Tried monsterinsights or other plugins
    4) Clean / purge caches TONS of times, hosting and ezoic.
    5) Chrome tag manager extension for checking if triggers are fired… seems to work but I recive this warning “Non-standard implementation”, did some digging doesnt found how to fix.

    I see ?amp pageviews on google analytics but I feel GA is not getting all pageviews because of the different pageviews data on hosting and ezoic. I tried to

    Maybe this is an AMP cache problem because of the /amp/ to ?amp urls? I tried to update some pages following this guide, but I dont know if I have to update ALL 12k pages:
    https://amp.dev/documentation/examples/guides/using_the_google_amp_cache/

    Any idea would be VERY apreciated.

    Thanks

    The page I need help with: [log in to see the link]

Viewing 15 replies - 1 through 15 (of 21 total)
  • Plugin Author Weston Ruter

    (@westonruter)

    When the amphtml URL changes there can be a few days of AMP traffic dropoff while waiting for the new AMP URLs to be indexed. That’s what I’ve seen in any case.

    This is partly why we’re working on making the AMP URLs more configurable and stable per https://github.com/ampproject/amp-wp/issues/2204

    Plugin Author Weston Ruter

    (@westonruter)

    Have you considered Standard mode? Then there will not be any separate AMP version and no two sets of URLs to deal with. Since your AMP version looks the same as the non-AMP version then it could just simplify things while also making your site faster for desktop visitors.

    jorgitobg

    (@jorgitobg)

    Hi Weston,

    Really apreciate your fast and awesome support, thanks!

    I did the change 21th march, today is 27th march…. how many days do you think we will need to clean and update complete amp cache?

    Actually I use non-amp and amp pages because of advertising. Im working with EZOIC and their system makes 50% less incoming from amp ads than non-amp ads. Do you know EZOIC? Maybe you recommend other programatic advertiser company?.

    Im talking with https://wpadvancedads.com/add-ons/responsive-ads/ developer to found a way to integrate their add-on plugin on our site, but makes no much sense when EZOIC changes ALL output code with their nameserver integration.

    Any idea?

    Regards

    Plugin Author Weston Ruter

    (@westonruter)

    For the time involved to update the index, it would be best if you reached out to Google Webmasters Help Community. Also consider joining an upcoming office hours event: there’s an event coming up this next Tuesday. I don’t have first-hand knowledge of Google Search indexing behavior.

    In regards to advertising, @jamesosborne would be able to help you best.

    Plugin Support James Osborne

    (@jamesosborne)

    @jorgitobg Advanced Ads is a great plugin to use for your AMP URLs. While I don’t have much experience with EZOIC I know the plugin converts all traditional ad code untils into AMP ad units on the AdSense network.

    If you’re having trouble using plugins to auto convert you could always use conditional statements to insert ad code based on AMP or non AMP URLs, similar to the below:
    <?php if ( function_exists( ‘is_amp_endpoint’ ) && is_amp_endpoint() ) : ?>
    // amp ad code
    <amp-ad>…</amp-ad>
    <?php else : ?>
    // regular ad code
    <script>…</script>
    <?php endif; ?>

    jorgitobg

    (@jorgitobg)

    Thanks Weston and James, you are very welcome!

    After switching off ezoic system and back to adsense ads load speed is very much faster!

    Acording to ezoic the problem is the “header bidding” system, which makes more revenue but loses speed.

    Hi again,

    Today, 10 days after I switch /amp/ pages to ?amp my analytics still doesnt working…. now im not receiving any logs from AMP traffic.

    Where can I get help to check what is really happening?

    Regards

    Plugin Author Weston Ruter

    (@westonruter)

    I just tried searching Google for “Ejercicios De Concentración: 8 Técnicas” on mobile and I do indeed see a result from your site and it has the AMP badge. Tapping on the link opens the site in Google’s AMP viewer: https://www.google.com/amp/s/hermandadblanca.org/ejercicios-de-concentracion-la-importancia-de-esta-gran-habilidad-y-las-tecnicas-que-pueden-ayudarnos-a-desarrollarla/%3famp

    So I see no problem from the search indexing front.

    How are you monitoring traffic?

    This must shows ALL pages after <body> tag. Maybe you can take a look on html code and tell me if you found it?…:

    ?><!– AMP Analytics –>
    <amp-analytics type=”googleanalytics”>
    <script type=”application/json”>
    {
    “vars”: {
    “account”: “UA-861219-1”
    },
    “triggers”: {
    “trackpageviewGHB11235”: {
    “on”: “visible”,
    “request”: “pageview”
    },
    “pageTimerGHB11235”: {
    “on”: “timer”,
    “timerSpec”: {
    “interval”: 15,
    “maxTimerLength”: 16
    },
    “request”: “event”,
    “vars”: {
    “eventId”: “timer”,
    “eventCategory”: “timer”,
    “eventAction”: “read”
    }
    },
    “trackanchorclicksGHB11235”: {
    “on”: “click”,
    “selector”: “a”,
    “request”: “event”,
    “vars”: {
    “eventId”: “42”,
    “eventLabel”: “clickedonalink”
    }
    }

    }
    }
    </script>
    </amp-analytics>
    <!– END AMP Analytics –><?php

    Plugin Author Weston Ruter

    (@westonruter)

    Yes, that’s normal if accessing the link on desktop. On mobile it won’t redirect.

    Plugin Author Weston Ruter

    (@westonruter)

    Here’s the analytics element I see:

    <amp-analytics type="googleanalytics" data-block-on-consent="" class="i-amphtml-layout-fixed i-amphtml-layout-size-defined" style="width:1px;height:1px;" i-amphtml-layout="fixed">
            <script type="application/json">
              {
                  "vars": {
                      "account": "UA-861219-1"
                  },            
                  "triggers": {
                      "trackpageviewGHB11235": {
                          "on": "visible",
                          "request": "pageview"
                      },
                      "pageTimerGHB11235": {
                          "on": "timer",
                          "timerSpec": {
                              "interval": 15,
                              "maxTimerLength": 16
                          },
                          "request": "event",
                          "vars": {
                              "eventId": "timer",
                              "eventCategory": "timer",
                              "eventAction": "read"
                          }
                      },
                      "trackanchorclicksGHB11235": {
                          "on": "click",
                          "selector": "a",
                          "request": "event",
                          "vars": {
                              "eventId": "42",
                              "eventLabel": "clickedonalink"
                          }
                      }
    
                  }
              }        
            </script>
          </amp-analytics>
    Plugin Author Weston Ruter

    (@westonruter)

    Where is data-block-on-consent coming from?

    “data-block-on-consent”? Thats a good question!

    I think I copied the code from before AMP plugin “AMPFORWP”… I really doesnt know what means.

    I just realice my code doesnt have “data-block-on-consent”

    <amp-analytics type=”googleanalytics”>
    <script type=”application/json”>

    This code is inserted by a plugin… after this on code you can see:

    <amp-analytics type=”googleanalytics” data-block-on-consent=”” class=”i-amphtml-layout-fixed i-amphtml-layout-size-defined” style=”width:1px;height:1px;” i-amphtml-layout=”fixed”>

    • This reply was modified 5 months, 3 weeks ago by jorgitobg.
Viewing 15 replies - 1 through 15 (of 21 total)
  • You must be logged in to reply to this topic.