DavidWells / DavidWells/analytics
not working if google-tag-manager initialized before via script
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 2.7k
- Forks
- 267
- PR merge metrics
- No merged PRs in 30d
Description
I've developed a separate widget that can be installed on clients website.
And issue appears if clients have their google-tag-manager initialised already via script with the same containerId
Here is an example
const analytics = Analytics({
app: 'vr-crm',
plugins: [
googleTagManager({
containerId
})
]
})
And use it like this
analytics.track(
'dayClickEvent',
{
value: dayStr
},
() => console.log('analytics called dayClickEvent on ', dayStr)
)
And it outputs callback but never fires the event.
So i have 2 questions:
1st - is this expected behaviour?
2nd - is there any way to use already initialised google-tag-manager in Analytics?
And it works fine when i remove google-tag-manager <script> from my website
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 by reproducing the issue with the existing Google Tag Manager script loaded before the Analytics configuration, using the provided containerId and track call. Compare it with the case where the script is removed, then determine whether the Google Tag Manager integration can use the existing initialization and define completion by making the event fire in the pre-initialized case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- analytics
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100