segmentio / segmentio/analytics.js-integrations

Conflict between `analytics.js-integration-google-adwords-new` and `analytics.js-integration-google-analytics-4`

Open
#687 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
125
Forks
136
Avg merge
2h 45m
Merged PRs (30d)
1

Description

When using both integrations on the same website, they override each other's window.gtag, so the latter loaded script will override the first one, and the events of the first one will not be reported to the destination.

From analytics.js-integration-google-analytics-4/lib/index.js:

window.gtag = function () {
        window.ga4DataLayer.push(arguments);
    };

From analytics.js-integration-google-adwords-new/lib/index.js:

window.gtag = function() {
    window.dataLayer.push(arguments);
  };

Contributor guide

No contributing guide indexed for this repository

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 by comparing the gtag setup in analytics.js-integration-google-analytics-4/lib/index.js and analytics.js-integration-google-adwords-new/lib/index.js. Reproduce a site using both integrations in different load orders, then verify that events continue reaching both destinations regardless of which integration loads first.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
analytics
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.