All Projects → TriPSs → react-tag-manager

TriPSs / react-tag-manager

Licence: MIT license
Google Tag Manager for React

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to react-tag-manager

Tag Manager
Free Open Source Matomo Tag Manager - A simple way to manage and maintain all of your (third-party) tags on your website.
Stars: ✭ 91 (+279.17%)
Mutual labels:  manager, tag
slider-manager
simple wrapper to create sliders focused on animations
Stars: ✭ 28 (+16.67%)
Mutual labels:  manager
RouteManager
iOS模块化,模块间解耦,路由中心设计
Stars: ✭ 45 (+87.5%)
Mutual labels:  manager
gpkg
🌎 A global Node binary manager written in Rust
Stars: ✭ 53 (+120.83%)
Mutual labels:  manager
git-tag-action
[GitHub Action] Get ${version} from package.json and git tag ${version} for the repository.
Stars: ✭ 26 (+8.33%)
Mutual labels:  tag
NotionAI-MyMind
This repo uses AI and the wonderful Notion to enable you to add anything on the web to your "Mind" and forget about everything else.
Stars: ✭ 181 (+654.17%)
Mutual labels:  tag
PASSY
This project has moved to GitLab.com
Stars: ✭ 14 (-41.67%)
Mutual labels:  manager
scimgateway
Using SCIM protocol as a gateway for user provisioning to other endpoints
Stars: ✭ 98 (+308.33%)
Mutual labels:  manager
jade
Asterisk based call center solution
Stars: ✭ 41 (+70.83%)
Mutual labels:  manager
material-chip-view
Material Chip view. Can be used as tags for categories, contacts or creating text clouds
Stars: ✭ 1,300 (+5316.67%)
Mutual labels:  tag
mgit
🌊 Manage multiple git repositories.
Stars: ✭ 28 (+16.67%)
Mutual labels:  tag
awesome-git-commands
🍴 Indispensable git commands for everyday use
Stars: ✭ 53 (+120.83%)
Mutual labels:  tag
sqlite-gui
Lightweight SQLite editor for Windows
Stars: ✭ 151 (+529.17%)
Mutual labels:  manager
employeeManager
自己尝试写的一个简单的考勤管理系统,包含管理成员信息以及成员考勤,管理员审批的功能,采用SpringMVC+Hibernate4+Spring搭建
Stars: ✭ 40 (+66.67%)
Mutual labels:  manager
fzf-checkout.vim
Manage branches and tags with fzf
Stars: ✭ 187 (+679.17%)
Mutual labels:  tag
Tasks
Simple tasks & notes manager written in PHP, jQuery and Bootstrap using a custom flat file database.
Stars: ✭ 102 (+325%)
Mutual labels:  manager
redis-manager
Redis manager for laravel-admin
Stars: ✭ 97 (+304.17%)
Mutual labels:  manager
lfimg
Image preview support for lf (list files) using Überzug
Stars: ✭ 174 (+625%)
Mutual labels:  manager
MP4Parse
C++ library for MP4 file parsing.
Stars: ✭ 55 (+129.17%)
Mutual labels:  tag
gradle-git-versioning-plugin
This extension will set project version, based on current Git branch or tag.
Stars: ✭ 44 (+83.33%)
Mutual labels:  tag

Google Tag Manager


Installation

$ npm install --save react-tag-manager
$ yarn add react-tag-manager

Examples

Enabling and loading the Google Tag Manager

import GTM from 'react-tag-manager'

export const AppContainer = () => (
  <div>
    <GTM 
      gtm={{
        id: 'GTM-12345',
        auth: '',      // Optional
        preview: '',   // Optional 
      }} 
      settings={{
        sendPageView: true,     // default false
        pageView: {             // default null
          event: 'pageview',    // default
          data : {},            // default
          
          settings: { 
            locationProp: 'pathname', // default
            sendAs      : 'url',      // default
          },
        }
      }}>
    	...
    </GTM>
  </div>
)

Updating / Adding data to the data layer

import DataLayer from 'react-tag-manager/DataLayer'

export const Component = () => (
  <div>
    // All props will be added to the data layer
    <DataLayer 
      foo={'bar'}
    />
        
    <DataLayer 
      foo={'bar'}
      settings={{
        passProps: true, 	// default false, will pas all the given props to the child components
        withGTM: true, 		// default false, will add GTM to the child components
      }}>
      ...
    </DataLayer>

    ...
  </div>
)

Trigger a event

import React from 'react'
import { withGTM } from 'react-tag-manager'

@withGTM
export default class extends from React.Component {

  handleButtonClick = () => {
    const { GTM } = this.props
    
    GTM.api.trigger({
      event: 'my-button-click',
      bar: 'foo'
    })
  }
  
  render() {
    return (
      <div>
        <button onClick={this.handleButtonClick} />
      </div>
    )
  }
  
}

Trigger a pageview event

import React from 'react'
import { PageView } from 'react-tag-manager'

export default class extends from React.Component {

  render() {
    return (
      <div>
      	<PageView />
        ...
      </div>
    )
  }
  
}

Trigger a onClick event

import React from 'react'
import { Click } from 'react-tag-manager'

export default class extends from React.Component {

  render() {
    return (
      <div>
      	<Click
      	  event={'click'}
      	  data={{
      	    event: 'click',
      		...
      	  }}>
      	  <button>CLICK ME</button>
      	</Click>
        ...
      </div>
    )
  }
  
}

Development

If you'd like to contribute to this project, all you need to do is clone this project and run:

$ npm install
$ npm run build
$ npm run build:watch // To recompile files on file change

Using development version in local project

You can use npm link / yarn link to use your development version in your own project:

  • Go to react-tag-manager directory and execute command npm link / yarn link
  • Go to your project directory and execute command npm link react-tag-manager / yarn link react-tag-manager

License

React Tag Manager is MIT licensed.

Collaboration

If you have questions or issues, please open an issue!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].