I am trying to integrate adobe analytics in an amp page. But the parameters that I want to pass, I want them to be picked up dynamically using an ajax call. I am picking up the values using an amp-list. The ajax response is somewhat like below:
{
"items": [
{
"user_type": "site_user",
"user_id": "anonymous"
}
]
}
In the amp-analytics section I am trying to read the dynamic values of user_type and user_id using curly braces syntax. My code snippet looks like this:
<amp-analytics type="adobeanalytics_nativeConfig">
<script type="application/json">
{
"requests": {
"base": "${base}",
"iframeMessage": "${base}/stats.html?user_type={{user_type}}&user_id={{user_id}}"
},
"vars": {
"host": "${host}"
}
}
</script>
</amp-analytics>
But instead of getting the values in the stats.html iframe request, the same syntax with curly braces itself is getting passes as values in the query parameters. This is what I am getting when the amp-analytics tag is defined outside the amp-list block. When I am putting the entire amp-analytics block within amp-list block, I do not see the stats.html call getting triggered. In browser console I am getting the below error:
No request strings defined. Analytics data will not be sent from this page. Ignoring event. Request string not found: iframeMessage
Both base
and host
are jstl variables and they are getting replaced with their proper values.
Can anyone please help on passing the dynamic values to structure the json iframe?