Skip to content

Latest commit

 

History

History
47 lines (37 loc) · 811 Bytes

README.md

File metadata and controls

47 lines (37 loc) · 811 Bytes

Installation

yarn add react-gtm-components

Usage

import { GtmScript, GtmNoScript } from 'react-gtm-components'

const gtmId = 'GTM-0000000'

<html>
	<head>
		<GtmScript gtmId={gtmId} />
		...
	</head>
	<body>
		<GtmNoScript gtmId={gtmId} />
		...
	</body>
</html>
import { GtmScript, GtmNoScript } from 'react-gtm-components'

const gtmId = 'GTM-0000000'
const gtmUrlParams = NODE_ENV === 'development' ? {
	gtm_auth: 'my_auth_key',
	gtm_preview: 'env-123',
} : {}

<html>
	<head>
		<GtmScript gtmId={gtmId} gtmUrlParams={gtmUrlParams} />
		...
	</head>
	<body>
		<GtmNoScript gtmId={gtmId} gtmUrlParams={gtmUrlParams} />
		...
	</body>
</html>

Examples/Tests

Check https://github.com/Yankovsky/react-gtm-components/blob/master/soon-to-be-test-folder/index.jsx