ampproject / ampproject/amphtml
amp-ad preventing amp-analytics from running
- Dominant language
- JavaScript
- Stars
- 14.9k
- Forks
- 4.1k
- PR merge metrics
- No merged PRs in 30d
Description
### Description
I was running up against a peculiar issue with an AMP deployment that I can’t quite figure out. We have an `amp-analytics` tag on the page, which on Pageview (or page visible), will call a function exported by an `amp-script` to pass along some information about the page.
However, it doesn’t work when this particular piece of HTML is inside an `amp-ad` tag:
```
```
### Reproduction Steps
1. Go to: https://www.corriere.it/test/Audiweb_amp/permutive_30032022_amp.html
2. Accept any consent pop-up
3. Open chrome dev-tools and switch to network tab
4. Filter network requests by XHR and by "permutive events"
5. Open payload of the request and drill down the object into `properties.client`
6. Notice that the url field (`properties.client.url`) is empty. This should be provided by our amp-analytics vendor config (permutive-ampscript) but isnt.
7. Using chrome's local overrides, remove that piece of HTML from the page and reload
8. Filter network requests by XHR and by "permutive events"
9. Open payload of the request and drill down the object into `properties.client`
10. Notice that the url field (`properties.client.url`) is now filled. This is now provided by our amp-analytics vendor config (permutive-ampscript).
### Relevant Logs
_No response_
### Browser(s) Affected
_No response_
### OS(s) Affected
_No response_
### Device(s) Affected
_No response_
### AMP Version Affected
_No response_
Contributor guide
Research direction
Reproduce the behavior at the linked test page with the amp-ad block present and removed, then inspect the amp-analytics, amp-script, and amp-ad interaction described in the steps. Compare the Permutive event payloads, especially properties.client.url; done means identifying and correcting the behavior so the URL is populated when the ad markup is present.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100