1.8.0 • Published 4 years ago

@d-cat/tag-template-google-tag-manager v1.8.0

Weekly downloads
2
License
ISC
Repository
gitlab
Last release
4 years ago

Tag Template: @d-cat/tag-template-google-tag-manager

codecov

Tag Template that injects Google Tag Manager in head of a web page.

Install

npm i @d-cat/tag-template-google-tag-manager

Usage

The Tag Template accepts 1 argument: id.

propertytypedescription
idstringGoogle Tag Manager Container ID.
import GoogleTagManager from '@d-cat/tag-template-google-tag-manager';

const myGTMComponent = async () => {
  const id = 'GTM-XXXXXX';
  const gtm = new GoogleTagManager(id);

  return await gtm.render();
};

render(): Promise<boolean>

You can inherit the render method. The method injects the Google Tag Manager script, if it does not already exist.

import GoogleTagManager from '@d-cat/tag-template-google-tag-manager';

export default class MyClass extends GoogleTagManager {
  constructor(...props: any[]) {
    super(...props);
  }

  public async render(...args: any[]): Promise<boolean> {
    await super.render(...args);

    // here you can add your own logic.
  }
}
1.8.0

4 years ago

1.7.0

4 years ago

1.6.0

4 years ago

1.5.0

4 years ago

1.4.0

4 years ago

1.3.0

4 years ago

1.2.0

4 years ago

1.1.0

4 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago