Google Analytics does not send custom parameters to AMP

This used to work, but now when I add the following code snippet from the Google Analytics AMP integration page, it does not make a call collectto Google Analytics https://developers.google.com/analytics/devguides/collection/amp-analytics/#extending_googleanalytics

<amp-analytics type="googleanalytics" id="analytics1">
<script type="application/json">
{
  "requests": {
    "pageviewWithCd1Cd3": "${pageview}&cd1=${cd1}&cd3=${cd3}"
  },
  "vars": {
    "account": "UA-XXXXX-Y"
  },
  "triggers": {
    "trackPageviewWithCustom" : {
      "on": "visible",
      "request": "pageviewWithCd1Cd3",
      "vars": {
        "title": "Classic Cars",
        "cd1": "registeredUser",
        "cd3": "automotive"
      }
    }
  }
}
</script>
</amp-analytics>

I replaced the account with a real account, starting with UA

I also have an analytics script tag included in the header:

<script async custom-element="amp-analytics" src="https://cdn.ampproject.org/v0/amp-analytics-0.1.js"></script>

The page view calls the request collect, but cd1it is cd3not included in the request parameters, and the values ​​of the cd1 and cd3 parameters are not passed in the URL request parameters.

Has anyone else had this problem since November 17th?

+4
2

- dp = ${newPageName}, "newPageName" - url

<amp-analytics type="googleanalytics" id="analytics1">
<script type="application/json">
{
  "requests": {
    "pageviewWithCustomPageCd1Cd3": "${pageview}&dp=${newPageName}"
  },
  "vars": {
    "account": "UA-XXXXX-Y"
  },
  "triggers": {
    "trackPageviewWithCustom" : {
      "on": "visible",
      "request": "pageviewWithCustomPageCd1Cd3",
      "vars": {
        "title": "Classic Cars",    
        "cd1": "registeredUser",
        "cd3": "automotive",
        "newPageName": "sample.html?amp=1&cd1=${cd1}&cd3=${cd3}"
      }
    }
  }
}
</script>
</amp-analytics>
0

Source: https://habr.com/ru/post/1663887/


All Articles