Skip to content

Latest commit

 

History

83 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ngx-Gtm

Build Release NPM Downloads

Angular library that automatically injects the script tag required to use Google Tag Manager.

Installation

npm:

npm install --save @jerkovicl/ngx-gtm

Yarn:

yarn add @jerkovicl/ngx-gtm

Compatibility

Version Angular Version
1.5.x >=17 <=22
1.4.x >=17 <=20
1.x.x >=17 <=19

Features

Usage

Import provideGtm from ngx-gtm and pass the required configuration when using it as a provider during application bootstrap.

import { provideGtm } from '@jerkovicl/ngx-gtm';

@NgModule({
  providers: [
    provideGtm({
      enabled: true,
      id: 'tag-id',
    }),
  ],
})
export class AppModule {}

// Or if you are using standalone bootstrap

bootstrapApplication(AppComponent, {
  providers: [
    provideGtm({
      enabled: true,
      id: 'tag-id',
    }),
  ],
});

Checkout the demo application in the demo folder for a working example.

The supported configuration parameters are:

Property Requirement Description
enabled Required Whether or not this module is enabled. Useful for disabling the script in development environments.
id Required Your Google Tag Manager tag Id. This is found in the Google Tag Manager settings page.

License

MIT

About

Google Tag Manager integration for Angular

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages