segmentio/analytics.js-integrations

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

ayeletcohen opened this issue · 0 comments

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);
  };