A small utility library to programmatically insert analytics elements into the DOM.
# npm
npm i insert-analytics-elements
# yarn
yarn add insert-analytics-elements
// JavaScript
const googleAnalytics = require('insert-analytics-elements/googleAnalytics');
googleAnalytics.insertAnalyticsElements('UA-XXXXX-X')
// TypeScript
import { insertAnalyticsElements } from 'insert-analytics-elements/googleAnalytics';
insertAnalyticsElements('UA-XXXXX-X');
// JavaScript
const googleAnalyticsAsync = require('insert-analytics-elements/googleAnalytics/async');
googleAnalyticsAsync.insertAnalyticsElements('UA-XXXXX-X')
// TypeScript
import { insertAnalyticsElements } from 'insert-analytics-elements/googleAnalytics/async';
insertAnalyticsElements('UA-XXXXX-X');
// JavaScript
const googleAnalyticsGtag = require('insert-analytics-elements/googleAnalytics/gtag');
googleAnalyticsGtag.insertAnalyticsElements('UA-XXXXX-X')
// TypeScript
import { insertAnalyticsElements } from 'insert-analytics-elements/googleAnalytics/gtag';
insertAnalyticsElements('UA-XXXXX-X');
// JavaScript
const googleTagManager = require('insert-analytics-elements/googleTagManager');
googleTagManager.insertAnalyticsElements('GTM-XXXX')
// TypeScript
import { insertAnalyticsElements } from 'insert-analytics-elements/googleTagManager';
insertAnalyticsElements('GTM-XXXX');