Google Analytics is not designed to collect or monitor any information

We are facing issues with Google analytics as it does not seem to be tracking any data on our website. Here is the breakdown of how we have attempted to set it up:

  1. The tracking code is added in the Drupal headless backend CMS
  2. A dynamic front-end retrieves the tracking code based on the type of site
  3. The tracking is dynamically added to the Head section using Angular, specifically in the constructor

Tag assistant indicates the following problems:

- Missing Analytics.js script - No HTTP response detected

We have tried several solutions, including adding code in the body and experimenting with different types of trackings. We have also used the following code:

<!-- Global site tag (gtag.js) - Google Ads: 991964869 -->
<script data-cfasync="false" async src="https://www.googletagmanager.com/gtag/js?id=AW-991964869-1"></script>

<!-- Cross domain checking for the ticket sale CMS-->
<script data-cfasync="false">
  window.dataLayer = window.dataLayer || [];

  function gtag() {
    dataLayer.push(arguments);
  }
  gtag('js', new Date());

  gtag('config', 'UA-37890526-1');
</script>

<!-- Additonal scripts here ... -->

<!-- End Facebook Pixel Code -->

We are eager to resolve this issue and get the tracking to work!

Answer №1

Ensure that you simply paste the code provided by the Google Analytics API. I have included the following code within the <head></head> tags of my index.html file, and it is successfully tracking the data.

<script async src="https://www.googletagmanager.com/gtag/js?id=UA-134123456-1"></script>
  <script>
    window.dataLayer = window.dataLayer || [];
    function gtag() {
      dataLayer.push(arguments);
    }
    gtag('js', new Date());
    gtag('config', 'UA-134123456-1'); 
  </script>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Angular renders a dynamic URL as a document in response to an API call

Currently, I am working with Django and Angular. I have set up a dynamic URL that initially works fine when loading my product page. In Django, the URL is specified as "product/home/:productName/:productId". Everything is functioning correctly, but upon re ...

What is preventing my function from retrieving user input from an ngForm?

I'm currently working on my angular component's class. I am attempting to gather user input from a form and create an array of words from that input. The "data" parameter in my submit function is the 'value' attribute of the ngForm. Fo ...

Suitable typing for imported components lacking a common interface implementation

Looking for a way to avoid duplicating the array entries: import { ComponentA } from './components/A.component'; import { ComponentB } from './components/B.component'; const COMPONENTS: any[] = [ ComponentA, ComponentB ]; @NgModu ...

select certain columns from a dataset

I am looking to implement filtering for specific columns in a table using dropdown menus within the table itself. I want to individually filter the 3 columns highlighted in red, meaning each one should have its own dropdown menu for selection. View image d ...

Does [email protected] come with the AOT Compilation enabled by default?

Is AOT Compilation the default setting for [email protected] and angular/[email protected] ? We are in the process of migrating our apps today, and I'm unsure if the documentation is still up to date: https://angular.io/docs/ts/latest/cookbo ...

Utilizing a Material UI custom theme in React with Typescript: A step-by-step guide

Upon using the tool , I received a js file and a json file following the paths mentioned on the theme generator page: // src/ui/theme/index.js /* src/ui/theme/theme.json */ The files operate smoothly when left with the .js extension. However, when I attem ...

What is a suitable alternative to forkJoin for executing parallel requests that can still complete even if one of them fails?

Is there a more robust method than forkJoin to run multiple requests in parallel and handle failed subscriptions without cancelling the rest? I need a solution that allows all requests to complete even if one fails. Here's a scenario: const posts = th ...

What are the steps to successfully upload a nestjs application (using typescript) onto the heroku

After creating a nestjs app, I am now seeking the most efficient way to deploy it on Heroku for production environment. Upon attempting to deploy the code generated by nest-cli as-is, I received the following logs from Heroku: 2018-12-28T08:37:23.881261+ ...

How to access an element through the router-outlet in Angular 6?

<side-navigation [navigationTitle]="navTitle"></side-navigation> <router-outlet> </router-outlet> Within my project, I have a navigation bar located in the root component. I have set up [navigationTitle] as an @Input Decorator wit ...

How to extract a date from Mat-Datepicker without using moment library

I'm encountering an issue with Mat-datepicker in my Angular app. When I manually input the date into the field, it doesn't parse in the correct locale, but it displays correctly when selected from the month view. Recently, I made the switch from ...

Creating global variables in NodeJS allows you to access and modify data

Currently, this construct is being utilized to create a global LOG: declare global { let LOG: Logger; } // eslint-disable-next-line @typescript-eslint/no-namespace declare namespace globalThis { let LOG: Logger; } globalThis.LOG = new Logger(); It f ...

Error: Cannot access Angular 5 Title service at this time

When attempting to change the page title using BrowserModule, I encountered an issue. I added the BrowserModule and Title in the application module as shown here: https://angular.io/guide/set-document-title However, in a child module where I tried to add ...

How to disable typescript eslint notifications in the terminal for .js and .jsx files within a create-react-app project using VS Code

I'm currently in the process of transitioning from JavaScript to TypeScript within my create-react-app project. I am facing an issue where new ESLint TypeScript warnings are being flagged for my old .js and .jsx files, which is something I want to avo ...

JavaScript: ES6 string method 'repeat' not recognized

Scenario: My environment consists of Windows 10, TypeScript 1.8, and Visual Studio Code 1.0.0. I have the following code snippet: ///<reference path = "./typings/lib.es6.d.ts" /> and later on, let z = "0".repeat(4 - str.length) This is where the ...

Tips for resolving the error when setting up @ngrx/store?

I'm encountering an issue during the installation of @ngrx/store. Is there anyone who can assist me in resolving this error? PS C:\Users\Welcome\ngrx-test> npm install @ngrx/store npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to re ...

The announcement will not be made as a result of the utilization of a private name

I've been working on transitioning a project to TypeScript, and while most of the setup is done, I'm struggling with the final steps. My goal is to use this TypeScript project in a regular JavaScript project, so I understand that I need to genera ...

Tips on automatically changing the background image every few seconds

As a newcomer to Angular and programming in general, I am facing an issue with changing the background image of my Page using the setInterval method. The intended behavior is for it to change every second, but for some reason, it changes much faster than t ...

Error: Unable to find provider for InjectionToken MatDialogData when trying to mock dialog component in Jasmine testing suite

I ran into an issue while testing a dialog component with simontest extension in visual studio code. Unfortunately, the test case failed due to the following error: Dialog Component import { ComponentFixture, TestBed } from '@angular/core/testing&apo ...

Creating a shared function using TypeScript

Having a vue3 component that displays a list of items and includes a function to delete an item raises a concern about checking parameters and specifying the array for the filter operation. The goal is to create a universal function using typescript. <t ...

Transforming Attribute Directives into Elements in Angular 2

I've been trying to wrap my head around this Attribute Directive feature in Angular 2. Initially, I thought that directives could only be created using Attributes, but after some experimentation, I realized that I can also create directives using Ele ...