-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The library does not add GTM script to the DOM #169
Comments
It doesn't seem like you're importing it into the modules. You need to do: |
You should also do some thing in your app component !
And if with that, it's still not work use the
|
@mzuccaroli I noticed that the script here https://github.com/mzuccaroli/angular-google-tag-manager/blob/master/projects/angular-google-tag-manager/src/lib/angular-google-tag-manager.service.ts#L96 Honeslty I do not know why the base GTM snipped does not perform this client_id setting, I feel like Google just forgot to update it for everyone. Anyway, I think this package should do this at the end of the snipped
|
Hi there,
I'm following the manual instructions to use this package but for some reason, GTM script is not written on the DOM at all.
I'm running an angular 15 created with angular-CLI... clear fresh just to test the library. The only thing I did was install the library and add it to the app.module.ts file such as:
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
@NgModule({
declarations: [AppComponent],
imports: [BrowserModule, AppRoutingModule],
providers: [{ provide: 'googleTagManagerId', useValue: 'GTM-XXXXXX' }],
bootstrap: [AppComponent],
})
export class AppModule {}
This does not render the script.
Am I doing something wrong?
package.json file:
{
"name": "gtm-angular15",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"watch": "ng build --watch --configuration development",
"test": "ng test"
},
"private": true,
"dependencies": {
"@angular/animations": "^15.0.0",
"@angular/common": "^15.0.0",
"@angular/compiler": "^15.0.0",
"@angular/core": "^15.0.0",
"@angular/forms": "^15.0.0",
"@angular/platform-browser": "^15.0.0",
"@angular/platform-browser-dynamic": "^15.0.0",
"@angular/router": "^15.0.0",
"angular-google-tag-manager": "^1.7.0",
"rxjs": "~7.5.0",
"tslib": "^2.3.0",
"zone.js": "~0.12.0"
},
"devDependencies": {
"@angular-devkit/build-angular": "^15.0.5",
"@angular/cli": "~15.0.5",
"@angular/compiler-cli": "^15.0.0",
"@types/jasmine": "~4.3.0",
"jasmine-core": "~4.5.0",
"karma": "~6.4.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage": "~2.2.0",
"karma-jasmine": "~5.1.0",
"karma-jasmine-html-reporter": "~2.0.0",
"typescript": "~4.8.2"
}
}
The text was updated successfully, but these errors were encountered: