Socket
Socket
Sign inDemoInstall

analytics-plugin-google-tag-manager

Package Overview
Dependencies
0
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    analytics-plugin-google-tag-manager

Google tag manager plugin for 'analytics' module


Version published
Weekly downloads
18
decreased by-76.62%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

Google Tag Manager plugin for analytics

Note: This package has moved to @analytics/google-tag-manager

Integration with google tag manager for analytics

For more information see the docs.

Usage

Install analytics and @analytics/google-tag-manager packages

npm install analytics @analytics/google-tag-manager

Import and initialize in project

import Analytics from 'analytics'
import googleTagManager from '@analytics/google-tag-manager'

const analytics = Analytics({
  app: 'awesome-app',
  plugins: [
    googleTagManager({
      containerId: 'GTM-123xyz',
    })
    // ... other plugins
  ]
})

/* Track page views */
analytics.page()

/* Track custom events */
analytics.track('buttonClicked')

/* Identify visitors */
analytics.identify('user-xzy-123', {
  name: 'Bill Murray',
  cool: true
})

Configure Google Tag Manager

Make sure you have your google tags manager setup to fire on Page views.

If you are using a SPA you want to listen to history changes as well.

image

Plugin Options

Arguments

  • pluginConfig object - Plugin settings
  • pluginConfig.containerId string - The Container ID uniquely identifies the GTM Container.

Example

googleTagManager({
  containerId: 'GTM-123xyz'
})

See the full list of analytics provider plugins in the main repo.

Keywords

FAQs

Last updated on 07 Oct 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc