amp-htmlamp-analytics

amp analytics missing pageviewId64


I am trying to send some analytics data using amp-analytics component but for some reason, the packet is missing pageViewId64, I am getting pageViewId.

Minimal code to test- (Add amp-analytics component in the head if not already added)

<amp-analytics>
<script type="application/json">
{
"requests": {
  "pageview": "api-endpoint"
},
"transport": {
   "xhrpost": true,
   "useBody": true,
   "beacon": false
 },
 "extraUrlParams": {
    "pageViewId":"${pageViewId}",
    "pageViewId64":"${pageViewId64}",
    "timezone":"${timezoneCode}",
    "domain":"${ampdocHostname}"
},
"triggers": {
        "trackPageview": {
          "on": "visible",
          "request": "pageview"
        }
      }
}
</script>
</amp-analytics>

Request snapshot - enter image description here

Is there something that I am missing over here.?


Solution

  • I was able to use pageViewId64 by directly using the platform variable - PAGE_VIEW_ID_64 rather than looking for amp-analytics variable (${pageViewId64})

    i.e. -

    vars: {
      pageViewId64: "PAGE_VIEW_ID_64",
    }
    

    Another way is to assign platform variable to a var so that you can use it the usual way - ${pageViewId64}

    Request snapshot with direct platform variable -

    enter image description here