DavidWells / DavidWells/analytics

GTM plugin does not properly set event name

Open
#363 0 comments 1 reaction 0 assignees View on GitHub

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.