Skip to content
This repository has been archived by the owner on Nov 16, 2022. It is now read-only.

wappsify/react-static-plugin-google-tag-manager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

49 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

react-static-plugin-google-tag-manager ๐Ÿ“ˆ

License David dependencies

This plugin adds the GTM script tag to your HTML files. You only need to supply the GTM ID.

Installation

In an existing react-static site run:

$ yarn add -D react-static-plugin-google-tag-manager

Then add the plugin to your static.config.js:

export default {
  plugins: [
    [
      'react-static-plugin-google-tag-manager',
      {
        // example configuration
        id: 'your-gtm-id-here',
        debug: true,
      },
    ],
  ],
};

Options

In your static.config.js, you should pass configuration options to the plugin.

id: string

Pass your Google Tag Manager ID in here. The plugin will not work without it.

debug: boolean

Default value: false

When setting debug to true, the plugin will not check for stage === 'prod' and instead always inject the GTM. Useful for debugging data layer events and such locally.

cookieRestriction: object

cookieRestriction?: {
  cookieName: string;
  value: string | number;
}

Only loads the GTM when a cookie is set to the supplied value.

About

๐Ÿ“ˆA react-static plugin allowing you to add the GTM script tag to your page

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published