New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

analytics-plugin-google-tag-manager

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

analytics-plugin-google-tag-manager - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

35

dist/analytics-plugin-google-tag-manager.js

@@ -39,11 +39,26 @@ var analyticsGtagManager = (function () {

/* global dataLayer */
// Analytics Integration Configuration
var config$1 = {
assumesPageview: true
debug: false,
containerId: null // assumesPageview: true,
/**
* Google tag manager plugin
* @link https://developers.google.com/tag-manager/
* @param {object} pluginConfig - Plugin settings
* @param {string} pluginConfig.containerId - The Container ID uniquely identifies the GTM Container.
* @return {object} Analytics plugin
* @example
*
* googleTagManager({
* containerId: 'GTM-123xyz'
* })
*/
};
function googleTagManager$1(userConfig) {
function googleTagManager$1() {
var pluginConfig = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
// Allow for userland overides of base methods
return {
NAMESPACE: 'google-tag-manager',
config: Object.assign({}, config$1, userConfig),
config: _objectSpread({}, config$1, pluginConfig),
initialize: function initialize(_ref) {

@@ -87,3 +102,4 @@ var config = _ref.config;

var payload = _ref3.payload,
options = _ref3.options;
options = _ref3.options,
config = _ref3.config;

@@ -109,5 +125,8 @@ if (typeof dataLayer !== 'undefined') {

console.log('gtag push', _objectSpread({
event: payload.event
}, formattedPayload));
if (config.debug) {
console.log('gtag push', _objectSpread({
event: payload.event
}, formattedPayload));
}
dataLayer.push(_objectSpread({

@@ -114,0 +133,0 @@ event: payload.event

@@ -38,11 +38,26 @@ 'use strict';

/* global dataLayer */
// Analytics Integration Configuration
var config$1 = {
assumesPageview: true
debug: false,
containerId: null // assumesPageview: true,
/**
* Google tag manager plugin
* @link https://developers.google.com/tag-manager/
* @param {object} pluginConfig - Plugin settings
* @param {string} pluginConfig.containerId - The Container ID uniquely identifies the GTM Container.
* @return {object} Analytics plugin
* @example
*
* googleTagManager({
* containerId: 'GTM-123xyz'
* })
*/
};
function googleTagManager$1(userConfig) {
function googleTagManager$1() {
var pluginConfig = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
// Allow for userland overides of base methods
return {
NAMESPACE: 'google-tag-manager',
config: Object.assign({}, config$1, userConfig),
config: _objectSpread({}, config$1, pluginConfig),
initialize: function initialize(_ref) {

@@ -86,3 +101,4 @@ var config = _ref.config;

var payload = _ref3.payload,
options = _ref3.options;
options = _ref3.options,
config = _ref3.config;

@@ -108,5 +124,8 @@ if (typeof dataLayer !== 'undefined') {

console.log('gtag push', _objectSpread({
event: payload.event
}, formattedPayload));
if (config.debug) {
console.log('gtag push', _objectSpread({
event: payload.event
}, formattedPayload));
}
dataLayer.push(_objectSpread({

@@ -113,0 +132,0 @@ event: payload.event

@@ -36,11 +36,26 @@ function _defineProperty(obj, key, value) {

/* global dataLayer */
// Analytics Integration Configuration
var config$1 = {
assumesPageview: true
debug: false,
containerId: null // assumesPageview: true,
/**
* Google tag manager plugin
* @link https://developers.google.com/tag-manager/
* @param {object} pluginConfig - Plugin settings
* @param {string} pluginConfig.containerId - The Container ID uniquely identifies the GTM Container.
* @return {object} Analytics plugin
* @example
*
* googleTagManager({
* containerId: 'GTM-123xyz'
* })
*/
};
function googleTagManager$1(userConfig) {
function googleTagManager$1() {
var pluginConfig = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
// Allow for userland overides of base methods
return {
NAMESPACE: 'google-tag-manager',
config: Object.assign({}, config$1, userConfig),
config: _objectSpread({}, config$1, pluginConfig),
initialize: function initialize(_ref) {

@@ -84,3 +99,4 @@ var config = _ref.config;

var payload = _ref3.payload,
options = _ref3.options;
options = _ref3.options,
config = _ref3.config;

@@ -106,5 +122,8 @@ if (typeof dataLayer !== 'undefined') {

console.log('gtag push', _objectSpread({
event: payload.event
}, formattedPayload));
if (config.debug) {
console.log('gtag push', _objectSpread({
event: payload.event
}, formattedPayload));
}
dataLayer.push(_objectSpread({

@@ -111,0 +130,0 @@ event: payload.event

{
"name": "analytics-plugin-google-tag-manager",
"version": "0.1.0",
"version": "0.1.1",
"description": "Google tag manager plugin for 'analytics' pkg",

@@ -12,2 +12,3 @@ "keywords": [

"scripts": {
"docs": "node ../analytics-cli/bin/run docs",
"test": "echo \"Error: no test specified\" && exit 1",

@@ -43,3 +44,3 @@ "build": "node ../../scripts/build/index.js",

},
"gitHead": "cfd94ff8bf094a6024e824260238bc03eaf0d70f"
"gitHead": "745c4d599c4890b81d598df8017dae45b9fb60fa"
}

@@ -5,9 +5,18 @@ # Google analytics plugin for `analytics`

## Install
<!-- ANALYTICS_DOCS:START (TOC) -->
- [Usage](#usage)
- [Configure Google Tag Manager](#configure-google-tag-manager)
- [Plugin Options](#plugin-options)
<!-- ANALYTICS_DOCS:END (TOC) -->
```bash
npm install analytics-plugin-google-tag-manager --save
<!-- ANALYTICS_DOCS:START (USAGE) -->
## Usage
Install `analytics` and `analytics-plugin-google-tag-manager` packages
```
npm install analytics analytics-plugin-google-tag-manager
```
## Usage
Import and initialize in project

@@ -20,12 +29,13 @@ ```js

app: 'awesome-app',
version: 100,
plugins: [
googleTagManager({
containerId: 'Your-containerId'
containerId: 'GTM-123xyz'
})
]
})
```
<!-- ANALYTICS_DOCS:END -->
## Setup
## Configure Google Tag Manager

@@ -38,2 +48,19 @@ Make sure you have your google tags manager setup to fire on Page views.

<!-- ANALYTICS_DOCS:START (API) -->
## Plugin Options
**Arguments**
- **pluginConfig** <code>object</code> - Plugin settings
- **pluginConfig.containerId** <code>string</code> - The Container ID uniquely identifies the GTM Container.
**Example**
```js
googleTagManager({
containerId: 'GTM-123xyz'
})
```
<!-- ANALYTICS_DOCS:END -->
See the [full list of analytics provider plugins](https://github.com/DavidWells/analytics#current-plugins) in the main repo.
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