Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-gtm-module

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-gtm-module

React Google Tag Manager Module

  • 2.0.11
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
423K
decreased by-5.34%
Maintainers
1
Weekly downloads
 
Created

What is react-gtm-module?

The react-gtm-module package is a React wrapper for Google Tag Manager (GTM). It allows developers to easily integrate GTM into their React applications, enabling them to manage and deploy marketing tags without modifying the codebase directly.

What are react-gtm-module's main functionalities?

Initialize GTM

This feature allows you to initialize Google Tag Manager with a specific GTM ID. The GTM ID is provided in the `tagManagerArgs` object, and the `initialize` method sets up GTM for your application.

import TagManager from 'react-gtm-module';

const tagManagerArgs = {
  gtmId: 'GTM-XXXXXX'
};

TagManager.initialize(tagManagerArgs);

Data Layer Push

This feature allows you to push data to the GTM data layer. The `dataLayer` method takes an object with the data you want to push, such as events or page information.

import TagManager from 'react-gtm-module';

const dataLayerArgs = {
  dataLayer: {
    event: 'pageview',
    page: {
      url: '/home',
      title: 'Home Page'
    }
  }
};

TagManager.dataLayer(dataLayerArgs);

Custom Events

This feature allows you to send custom events to GTM. You can specify the event name and additional parameters like category, action, and label.

import TagManager from 'react-gtm-module';

const eventArgs = {
  event: 'customEvent',
  category: 'video',
  action: 'play',
  label: 'home page video'
};

TagManager.dataLayer({ dataLayer: eventArgs });

Other packages similar to react-gtm-module

Keywords

FAQs

Package last updated on 09 Sep 2020

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc