Hello @zotezo
Thank you for reaching out to us, the amp-script has limitations as it runs in web workers and don’t have access to main DOM, which means redirection won’t work.
the alternative will be to use amp state change to set URL and style button to look like button, but work as link.
<div class="wrapper">
<select on="change:AMP.setState({ url: event.value, var:false })">
<option value='https://amp-support.rt.gw/' selected="selected">home</option>
<option value='https://amp-support.rt.gw/contact/'>contact</option>
</select>
<a [href]="url" href="home" class="button">Go</a>
</div>
A working example can be found here
We hope this helps!
Thread Starter
zo
(@zotezo)
We need to track engagement using amp-analytics and below is json, click event works fine but clickDomain, clickClasses and clickUrl not get tracked! Any clue or guidance will be much appreciated here please…
"triggers":{
"click":{
"on": "click",
"selector": "a.gtm-list, a.gtm-detail, a.gtm-reviews, a.gtm-medicines",
"request": "ga4Event",
"vars":{
"ga4_event_name": "click"
},
"extraUrlParams":{
"event__str_link_domain": "${clickDomain}",
"event__str_link_url": "${clickUrl}",
"event__str_link_classes": "${clickClasses}"
}
}
}
Hello @zotezo
Thank you for reaching out to us, can you please confirm the parameters exist in request URL, for more information, please check amp-analytics documentation
Thread Starter
zo
(@zotezo)
Ok thanks.
We are now facing this issues Referenced AMP URL is not an AMP in the pages https://www.zotezo.com/us/top/best-zinc-supplements-in-usa/?amp how to fix that issue?
Thanks
Hello @zotezo
The error only shows when and AMP pages are not valid AMP page, or it’s been redirecting to non-AMP pages but When we checked we did not encounter any issue. Also, we did AMP test and everything looks good on your AMP page
@zotezo
As we didn’t receive a response I’ll mark this as resolved. Feel free to open a new support topic if you require any further assistance.