ampproject / ampproject/amphtml
Google Analytics page variables is not accessible in the GTM tags.
- Dominant language
- JavaScript
- Stars
- 14.9k
- Forks
- 4.1k
- PR merge metrics
- No merged PRs in 30d
Description
### Description
I have been trying to implement GA via GTM on my google AMP website. but the issue is i can't access page variables in the TAG i.e i want to get Tracking ID, Event Category, Event Action. Event Name and Event Value from page variables.
Can we access it in the TAGs?
### Reproduction Steps
1. Create AMP container
2. Implement GTM on your AMP pages.
3. Create page variables
```
{
"vars": {
"UAID": "UA-XXXXXXXX-X",
"product": "product",
"productAction": "add to cart",
"productTitle": "product title",
"productPrice": 100
}
}
```
And then use it in the tag as below.
https://jmp.sh/7yzl7E9
I know we can access it like this
```
{
"vars" : {
"type": "shoes",
"color": "red"
}
}
```
But i don't want to nest the variables
### 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
Start with the AMP page's amp-analytics configuration and the GTM AMP container described in the reproduction steps, including the linked tag example. Check how the declared page variables are exposed to tags and whether avoiding nested variables is supported. No repository file or test is named, so completion would require a confirmed behavior or documented resolution for the requested variable access.
Written by the indexing model from the issue text.
Assessment
- Domain
- analytics
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100