Support » Plugin: Glue for Yoast SEO & AMP » Google Tracking Code will not save

  • Hi there,

    the google tracking code will not be saved although it confirms saving. Please let me know how to fix this. Appreciated!

    Best,
    Elmar

Viewing 14 replies - 1 through 14 (of 14 total)
  • I hate when people ask but never answer, so here is the solution. You cannot use the Google Analytics code but need to use a modified AMP version of it.

    Check out:
    https://developers.google.com/analytics/devguides/collection/amp-analytics/

    May the force be with you!

    For me also… not saving?

    Ok. I get it… If not using [Google Analytics by MonsterInsights](https://wordpress.org/plugins/google-analytics-for-wordpress/), then you must include the whole Javascript bunch… in raw format.

    I have the same issue:

    Do I add this full code or just part of it?

    
      <amp-analytics type="googleanalytics" id="analyticsBlog">
      <script type="application/json">
      {
        "vars": {
          "account": "UA-XXXXXXX-1"
        },
        "triggers": {
          "trackPageview": {
            "on": "visible",
            "request": "pageview"
          },
          "trackAnchorClicks": {
            "on": "click",
            "selector": "a",
            "request": "event",
            "vars": {
              "eventCategory": "link",
              "eventAction": "Click"
            }
        }
      }
      </script>
      </amp-analytics>

    Yes, the whole <amp-analytics> thing.

    I also can’t get the code to save… have tried pasting the Tracking ID, the full UA tracking code, and the <amp-analytics> code above (with my ID), but the code block remains blank after I save.

    Same problem here…
    Can’t save analytics settings…
    How to solve it while the issue is not solved?

    Do you have an exemple about what you mean by raw format?

    Hello,
    same problem for me, also with amp-analytcs code, the code block remains blank!

    Waiting for a solution.

    Many thanks

    Check all the “{” and “}” in your code.
    I found that there was one missing in my code.
    That’s why it kept not salving.

    — dunno how to delete comment? 😉 —

    • This reply was modified 1 year, 6 months ago by  cvladan.
    • This reply was modified 1 year, 6 months ago by  cvladan.

    It is obvious that you must check JSON validity; not for the whole thing, but only what’s inside <script> tag. There a lot of online tools for that, one example would be this. Anyway, here is my “whole raw thing” that is working great:

    
    <amp-analytics type="googleanalytics" id="analytics1">
    <script type="application/json">
    {
      "vars": {
        "account": "UA-00000000-0"
      },
      "triggers": {
        "trackPageview": {
          "on": "visible",
          "request": "pageview"
        },
    
        "trackClickOnSomeShit" : {
          "on": "click",
          "selector": ".dummy_any_css_selector",
          "request": "event",
          "vars": {
            "eventCategory": "DummySomeCategory",
            "eventAction": "DummySomeAction"
          }
        }
      }
    
    }
    </script>
    </amp-analytics>
    

    Please note that there is some event tracking included, and that is not mandatory. But I just wanted to include whole thing.

    • This reply was modified 1 year, 6 months ago by  cvladan.

    Even when following all of the advice above, I too end up with a blank field every time I try to save my snippet. This leads me to believe the code is valid, but the form information is not being saved to WordPress database. I would appreciate some feedback from the plugin developer.

    Thanks @cvladan, your code works ok!

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘Google Tracking Code will not save’ is closed to new replies.