ampproject / ampproject/amphtml

Cannot read property 'replace' of undefined

Open
#34,621 3 comments 0 reactions 0 assignees View on GitHub
Component: amp-analytics P2: Soon Stale Type: Bug
Dominant language
JavaScript
Stars
14.9k
Forks
4.1k
PR merge metrics
No merged PRs in 30d

Description

### Description

how did I use it

in the head tag

` `

and in the body
```


{
"vars": {
"account": "UA-XXXXXX-1"
},
"triggers": {
"trackPageview": {
"on": "visible",
"request": "title_page"
}
}
}

```

index.js:108 Uncaught (in promise) TypeError: Cannot read property 'replace' of undefined
at ta (index.js:108)
at pf (amp-analytics.js:546)
at lf.push.f.l.ed (amp-analytics.js:291)

### Reproduction Steps

check online demo there
[https://mkaleh.com/category/%D8%B4%D8%A4%D9%88%D9%86_%D9%85%D9%86%D8%B2%D9%84%D9%8A%D8%A9](url)

### 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

Open the contributing guide

Research direction

Reproduce the error using the linked demo and the AMP Analytics configuration in the issue. Start at index.js:108 and the amp-analytics.js stack locations around lines 546 and 291, then confirm the undefined value and verify that the reported configuration no longer throws the replace error.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
analytics, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.