1.0.5 • Published 6 years ago

digital-google-tag-manager v1.0.5

Weekly downloads
-
License
ISC
Repository
-
Last release
6 years ago

#Google Tag Manager This is a very simple module for using Google Tag Manager as a middleware for redux

You need to supply an object of functions in the constructor (you can call it as a functions bucket) (Please see example file in the module)

You can set your own dataLayer (if you already loaded it) or you can create a new one with your own containerID

All you need is to use it as a middleware

##Example:

	const {dataLayer} = window;
	/* constructor */
	const googleTagManager = new GoogleTagManager(googleTagManagerFunctions);

	/* set the DataLayer */
	googleTagManager.setDataLayer(dataLayer);

	/* You can create a new dataLayer with you containerID */
	/* googleTagManager.createDataLayer('GTM-******'); */

	/* Create and get the middleware */
	const googleTagManagerMiddleWare = googleTagManager.createMiddleware();

Example for functions bucket to send to the constructor

	const GTM_FOOTER_new_subscriber = () => {
		return {
		 'event': 'new_subscriber',
		 'formLocation': 'footer'
		};
	};

	const googleTagManagerFunctions = {
		GTM_FOOTER_new_subscriber
	};

	export default googleTagManagerFunctions;
1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago