1.9.1 ā€¢ Published 1 month ago

@bravobit/ng-google-tag-manager v1.9.1

Weekly downloads
-
License
-
Repository
-
Last release
1 month ago

@bravobit/ng-google-tag-manager

The Angular Google Tag Manager library of the Bravobit team.

  • Use āŒ˜ Command + F or ctrl + F to search for a keyword.

Installation

To use the Angular Google Tag Manager in your project install it via npm:

$ npm install @bravobit/ng-google-tag-manager --save

Setup

You need to provide the Google Tag Manager config in your providers array in the AppModule. You can do that by using the provideGoogleTagManagerConfig() method.

import {provideGoogleTagManagerConfig} from '@bravobit/ng-google-tag-manager';
import {BrowserModule} from '@angular/platform-browser';
import {AppComponent} from './app.component';
import {NgModule} from '@angular/core';

@NgModule({
    imports: [BrowserModule],
    declarations: [AppComponent],
    bootstrap: [AppComponent],
    providers: [
        provideGoogleTagManagerConfig({id: 'GTM-XXXXXXX'})
    ]
})
export class AppModule {
}

Usage

You can use the Tag Manager everywhere in your project. You can simply push any object to the window.dataLayer by using the .push(object) method.

import {GoogleTagManager} from '@bravobit/ng-google-tag-manager';
import {OnInit} from '@angular/core';

export class AppComponent implements OnInit {

    constructor(private _tagManager: GoogleTagManager) {
    }

    ngOnInit() {
        this._tagManager.push({event: 'app root event'});
    }

}
1.9.1

1 month ago

1.9.0

2 months ago

1.2.0

11 months ago

1.8.0

6 months ago

1.7.1

9 months ago

1.7.0

9 months ago

1.6.0

9 months ago

1.5.0

10 months ago

1.4.1

10 months ago

1.4.0

10 months ago

1.3.0

10 months ago

1.1.0

11 months ago

1.0.1

11 months ago

1.0.0

11 months ago