DavidWells / DavidWells/analytics
GTM plugin does not properly set event name
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 2.7k
- Forks
- 267
- PR merge metrics
- No merged PRs in 30d
Description
The google-tag-manager plugin is not adding event names to any events (track, page) . I don't know if this is a bug or a support request, since no one else has reported this yet. I am using it with Next.js 13. I have not been unable to debug why just yet.
All dataLayer pushes for a track('My Event', payload) call have the event: "gtm.click" instead of event: "My Event"
I am using the package versions below.
"@analytics/google-tag-manager": "^0.5.3",
"analytics": "^0.8.1"
My first thought was, maybe this is by design? No problem, I'll override the name with a custom plugin. That had no effect though, and after looking at the code it's clear that this should not be necessary.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with packages/analytics-plugin-google-tag-manager/src/browser.js around the linked line 99, then reproduce a track('My Event', payload) and page call using the reported package versions. Compare the resulting dataLayer event values with the expected event name; done when the plugin emits the supplied names rather than gtm.click.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, next.js
- Domain
- web-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100