ampproject / ampproject/amphtml

vars as data attribute does not work on amp-story-page element

Open
#35,859 2 comments 0 reactions 0 assignees View on GitHub
Type: Bug WG: analytics
Dominant language
JavaScript
Stars
14.9k
Forks
4.1k
PR merge metrics
No merged PRs in 30d

Description

### Description

I'm trying to send analytics to GA. I've created a `var as data attribute` like is and place it on `amp-story-page` like it's written here: https://github.com/ampproject/amphtml/blob/main/extensions/amp-analytics/analytics-vars.md#variables-as-data-attribute.

but it doesn't seem to work.
All the other parameters are working.

![image (1)](https://user-images.githubusercontent.com/62942039/131346211-d46f6f98-89b9-42f1-beab-272e26870c42.png)
![image (2)](https://user-images.githubusercontent.com/62942039/131346224-3112c874-1efd-4078-b6cd-529d913df1fa.png)

### Reproduction Steps

1. create `amp-story-page`
2. add a data attribute
3. try to send it to google analytics

### Relevant Logs

_No response_

### Browser(s) Affected

Chrome

### OS(s) Affected

_No response_

### Device(s) Affected

_No response_

### AMP Version Affected

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with extensions/amp-analytics/analytics-vars.md and the amp-story-page reproduction described in the issue. Trace how amp-analytics reads data attributes on story pages, then reproduce the Google Analytics request in Chrome. Done means the documented attribute is recognized on amp-story-page and its value reaches the analytics request.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
analytics, web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.