Skip to content

Analytics GTAG script installed twice #2628

@emac3

Description

@emac3

Describe your environment

  • Operating System version: macOS Mojave 0.14.6 (18G3020)
  • Browser version: Chrome 80.0.3987.100 (Official Build) (64-bit)
  • Firebase SDK version: [email protected]
  • Firebase Product: analytics

[REQUIRED] Describe the problem

When I load Firebase Web with analytics on Chrome with the
Google Analytics Debugger extension enabled, I get the following warning from the console: "GTAG script is installed twice."

Steps to reproduce:

Load a page with Firebase Analytics.

Relevant HTML head scripts:

<head>
  <script type="text/javascript" async="" src="http://www.googletagmanager.com/gtag/js?id=G-XXX&amp;l=dataLayer&amp;cx=c"></script>
  <script src="https://www.googletagmanager.com/gtag/js?l=dataLayer" async=""></script>
</head>

Google Analytics Debugger extension logs:

  __ _| |_ __ _  __ _   (_)___
 / _` | __/ _` |/ _` |  | / __|
| (_| | || (_| | (_| |_ | \__ \
 \__, |\__\__,_|\__, (_)/ |___/
 |___/          |___/ |__/


11:35:18.946 Processing commands (1)
11:35:18.946 Processing GTAG command: ["js", Thu Feb 13 2020 11:35:18 GMT+0100 (Central European Standard Time)]
11:35:18.948 No tags fired for event: gtm.js
11:35:18.949 Processing commands (1)
11:35:18.949 Processing GTAG command: ["config", "G-XXX", {firebase_id: "XXX", origin: "firebase", update: true}]
11:35:18.950 GTAG Command: "config", target: "G-XXX", configuration: {firebase_id: "XXX", origin: "firebase", update: true}
11:35:18.952 Tag fired: {function: "__get", vtp_trackingId: "G-XXX", vtp_isAutoTag: true}
11:35:18.955 Processing commands (0)
11:35:18.956 Processing commands (1)
11:35:18.956 Processing data layer push: {event: "gtm.dom"}
11:35:18.956 No tags fired for event: gtm.dom
11:35:18.957 Processing commands (1)
11:35:18.957 Processing data layer push: {event: "gtm.load"}
11:35:18.957 No tags fired for event: gtm.load
11:35:19.010        _                 _
  __ _| |_ __ _  __ _   (_)___
 / _` | __/ _` |/ _` |  | / __|
| (_| | || (_| | (_| |_ | \__ \
 \__, |\__\__,_|\__, (_)/ |___/
 |___/          |___/ |__/


11:35:19.014 Processing commands (4)
11:35:19.014 Processing GTAG command: ["js", Thu Feb 13 2020 11:35:18 GMT+0100 (Central European Standard Time)]
11:35:19.016 gsi could not be evaluated client side. This container may have different behavior outside debug mode.
11:35:19.016 ftld lookup could not be evaluated client side. This container may have different behavior outside debug mode.
11:35:19.017 icvr could not be evaluated client side. This container may have different behavior outside debug mode.
11:35:19.019 gsi could not be evaluated client side. This container may have different behavior outside debug mode.
11:35:19.019 ftld lookup could not be evaluated client side. This container may have different behavior outside debug mode.
11:35:19.019 icvr could not be evaluated client side. This container may have different behavior outside debug mode.
11:35:19.019 Tag fired: {function: "__gct", instance_name: "8", vtp_trackingId: "G-XXX", vtp_adFeatures: false, vtp_sessionDuration: 0, vtp_googleSignals: ["macro", 1], vtp_foreignTld: ["macro", 2], vtp_restrictDomain: ["macro", 3], vtp_eventSettings: ["map", "ecommerce_purchase", ["map", "blacklisted", false, "conversion", true], "purchase", ["map", "blacklisted", false, "conversion", true]], tag_id: 7}
11:35:19.023 Loaded existing client id: XXX
11:35:19.026 Event would be batched, but batching is disabled in debug mode.
11:35:19.027 Sending event "page_view" to undefined
11:35:19.027 Request parameters:
11:35:19.028 v: 2
11:35:19.028 tid: G-XXX
11:35:19.028 gtm: 2oe250
11:35:19.029 _p: 826320161
11:35:19.029 sr: 1920x1080
11:35:19.029 _dbg: 1
11:35:19.030 ul: en-us
11:35:19.030 _fid: XXX
11:35:19.030 cid: XXX
11:35:19.031 Event parameters:
11:35:19.031 en: page_view
11:35:19.032 ep.origin: firebase
11:35:19.032 Shared parameters:
11:35:19.033 dl: XXX
11:35:19.033 dr: XXX
11:35:19.033 dt: XXX
11:35:19.034 sid: XXX
11:35:19.034 sct: XXX
11:35:19.034 seg: XXX
11:35:19.035 Sending request: https://www.google-analytics.com/g/collect?v=2&tid=G-XXX&...
11:35:19.036 gsi could not be evaluated client side. This container may have different behavior outside debug mode.
11:35:19.037 ftld lookup could not be evaluated client side. This container may have different behavior outside debug mode.
11:35:19.037 icvr could not be evaluated client side. This container may have different behavior outside debug mode.
11:35:19.038 Processing GTAG command: ["config", "G-XXX", {firebase_id: "XXX", origin: "firebase", update: true}]
11:35:19.038 GTAG Command: "config", target: "G-XXX", configuration: {firebase_id: "XXX", origin: "firebase", update: true}
11:35:19.038 GTAG script is installed twice.
11:35:19.039 gsi could not be evaluated client side. This container may have different behavior outside debug mode.
11:35:19.039 ftld lookup could not be evaluated client side. This container may have different behavior outside debug mode.
11:35:19.039 icvr could not be evaluated client side. This container may have different behavior outside debug mode.
11:35:19.040 No tags fired for event: gtag.config
11:35:19.040 gsi could not be evaluated client side. This container may have different behavior outside debug mode.
11:35:19.040 ftld lookup could not be evaluated client side. This container may have different behavior outside debug mode.
11:35:19.040 icvr could not be evaluated client side. This container may have different behavior outside debug mode.
11:35:19.040 Processing data layer push: {event: "gtm.dom", gtm.uniqueEventId: 2}
11:35:19.041 gsi could not be evaluated client side. This container may have different behavior outside debug mode.
11:35:19.041 ftld lookup could not be evaluated client side. This container may have different behavior outside debug mode.
11:35:19.041 icvr could not be evaluated client side. This container may have different behavior outside debug mode.
11:35:19.041 No tags fired for event: gtm.dom
11:35:19.042 gsi could not be evaluated client side. This container may have different behavior outside debug mode.
11:35:19.042 ftld lookup could not be evaluated client side. This container may have different behavior outside debug mode.
11:35:19.042 icvr could not be evaluated client side. This container may have different behavior outside debug mode.
11:35:19.042 Processing data layer push: {event: "gtm.load", gtm.uniqueEventId: 3}
11:35:19.042 gsi could not be evaluated client side. This container may have different behavior outside debug mode.
11:35:19.042 ftld lookup could not be evaluated client side. This container may have different behavior outside debug mode.
11:35:19.043 icvr could not be evaluated client side. This container may have different behavior outside debug mode.
11:35:19.043 No tags fired for event: gtm.load
11:35:19.043 gsi could not be evaluated client side. This container may have different behavior outside debug mode.
11:35:19.043 ftld lookup could not be evaluated client side. This container may have different behavior outside debug mode.
11:35:19.043 icvr could not be evaluated client side. This container may have different behavior outside debug mode.

Relevant Code:

import * as firebase from "firebase/app";
import "firebase/analytics";
import React, { useState } from "react";
import { AnalyticsContext } from "./analyticsUtils";

const defaultConfig = {};

interface Props {
  config?: { [key: string]: any };
}

const AnalyticsProvider: React.FunctionComponent<Readonly<Props>> = function(
  props
) {
  const analytics = firebase
    .initializeApp({
      ...defaultConfig,
      ...props.config
    })
    .analytics();

  const [value] = useState({
    logEvent: analytics.logEvent
  });

  return (
    <AnalyticsContext.Provider value={value}>
      {props.children}
    </AnalyticsContext.Provider>
  );
};

export default AnalyticsProvider;

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions