Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

insert-analytics-elements

0.0.4 • Public • Published

insert-analytics-elements

Build Status npm version

A small utility library to programmatically insert analytics elements into the DOM.

Installation

# npm 
npm i insert-analytics-elements
# yarn 
yarn add insert-analytics-elements

Included Providers

Usage

Google Analytics

// 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');

Google Analytics with Async

// 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');

Google Analytics with gtag

// 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');

Google Tag Manager

// JavaScript
const googleTagManager = require('insert-analytics-elements/googleTagManager');
googleTagManager.insertAnalyticsElements('GTM-XXXX')
 
// TypeScript
import { insertAnalyticsElements } from 'insert-analytics-elements/googleTagManager';
insertAnalyticsElements('GTM-XXXX');

Keywords

install

npm i insert-analytics-elements

Downloadsweekly downloads

36

version

0.0.4

license

MIT

repository

githubgithub

last publish

collaborators

  • avatar