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

ga-4-react

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ga-4-react - npm Package Compare versions

Comparing version 0.1.22 to 0.1.23

dist/components/GA4RComponents.d.ts

41

dist/ga-4-react.cjs.development.js

@@ -22,3 +22,8 @@ 'use strict';

}
/**
* @desc Return main function for send ga4 events, pageview etc
* @returns {Promise<GA4ReactResolveInterface>}
*/
initialize() {

@@ -45,2 +50,3 @@ return new Promise((resolve, reject) => {

pageview: this.pageview,
event: this.event,
gtag: this.gtag

@@ -58,3 +64,3 @@ });

/**
* @desc set new page or send pageview event
* @desc send pageview event to gtag
* @param path

@@ -65,3 +71,3 @@ */

pageview(path) {
window.gtag('event', 'page_view', {
return this.gtag('event', 'page_view', {
page_path: path,

@@ -73,2 +79,22 @@ page_location: window.location,

/**
* @desc set event and send to gtag
* @param action
* @param label
* @param category
* @param nonInteraction
*/
event(action, label, category, nonInteraction) {
if (nonInteraction === void 0) {
nonInteraction = false;
}
return this.gtag('event', action, {
event_label: label,
event_category: category,
non_interaction: nonInteraction
});
}
/**
* @desc direct access to gtag

@@ -80,7 +106,4 @@ * @param args

gtag() {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return window.gtag(args);
//@ts-ignore
return window.gtag(...arguments);
}

@@ -114,4 +137,6 @@

exports.GA4R = GA4R;
var GA4R$1 = GA4R;
exports.GA4R = GA4R$1;
exports.default = GA4React;
//# sourceMappingURL=ga-4-react.cjs.development.js.map

2

dist/ga-4-react.cjs.production.min.js

@@ -1,2 +0,2 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("react"),a=(e=t)&&"object"==typeof e&&"default"in e?e.default:e;class i{constructor(e,t,a){this.gaCode=e,this.config=t,this.additionalGaCode=a,this.config=t||{},this.gaCode=e}initialize(){return new Promise((e,t)=>{var a=document.getElementsByTagName("head")[0],i=document.createElement("script");i.setAttribute("async",""),i.setAttribute("src","https://www.googletagmanager.com/gtag/js?id="+this.gaCode),i.onload=()=>{var t=document.createElement("script"),i="\n window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag('js', new Date());\n gtag('config', '"+this.gaCode+"', "+JSON.stringify(this.config)+");";this.additionalGaCode&&this.additionalGaCode.forEach(e=>{i+="gtag('config', '"+e+"');"}),t.innerHTML=i,a.appendChild(t),e({pageview:this.pageview,gtag:this.gtag})},i.onerror=e=>{t(e)},a.appendChild(i)})}pageview(e){window.gtag("event","page_view",{page_path:e,page_location:window.location,page_title:document.title})}gtag(){for(var e=arguments.length,t=new Array(e),a=0;a<e;a++)t[a]=arguments[a];return window.gtag(t)}}exports.GA4R=e=>{var{code:n,config:o,additionalCode:r,children:g}=e,[d,s]=t.useState(g);return t.useEffect(()=>{new i(""+n,o,r).initialize().then(e=>{s(a.Children.map(g,(t,i)=>a.cloneElement(t,{ga4:e,index:i})))},e=>{console.error(e)})},[]),a.createElement(a.Fragment,null,d)},exports.default=i;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("react"),a=(e=t)&&"object"==typeof e&&"default"in e?e.default:e;class n{constructor(e,t,a){this.gaCode=e,this.config=t,this.additionalGaCode=a,this.config=t||{},this.gaCode=e}initialize(){return new Promise((e,t)=>{var a=document.getElementsByTagName("head")[0],n=document.createElement("script");n.setAttribute("async",""),n.setAttribute("src","https://www.googletagmanager.com/gtag/js?id="+this.gaCode),n.onload=()=>{var t=document.createElement("script"),n="\n window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag('js', new Date());\n gtag('config', '"+this.gaCode+"', "+JSON.stringify(this.config)+");";this.additionalGaCode&&this.additionalGaCode.forEach(e=>{n+="gtag('config', '"+e+"');"}),t.innerHTML=n,a.appendChild(t),e({pageview:this.pageview,event:this.event,gtag:this.gtag})},n.onerror=e=>{t(e)},a.appendChild(n)})}pageview(e){return this.gtag("event","page_view",{page_path:e,page_location:window.location,page_title:document.title})}event(e,t,a,n){return void 0===n&&(n=!1),this.gtag("event",e,{event_label:t,event_category:a,non_interaction:n})}gtag(){return window.gtag(...arguments)}}exports.GA4R=e=>{var{code:i,config:o,additionalCode:r,children:g}=e,[d,s]=t.useState(g);return t.useEffect(()=>{new n(""+i,o,r).initialize().then(e=>{s(a.Children.map(g,(t,n)=>a.cloneElement(t,{ga4:e,index:n})))},e=>{console.error(e)})},[]),a.createElement(a.Fragment,null,d)},exports.default=n;
//# sourceMappingURL=ga-4-react.cjs.production.min.js.map

@@ -15,3 +15,8 @@ import React, { useState, useEffect } from 'react';

}
/**
* @desc Return main function for send ga4 events, pageview etc
* @returns {Promise<GA4ReactResolveInterface>}
*/
initialize() {

@@ -38,2 +43,3 @@ return new Promise((resolve, reject) => {

pageview: this.pageview,
event: this.event,
gtag: this.gtag

@@ -51,3 +57,3 @@ });

/**
* @desc set new page or send pageview event
* @desc send pageview event to gtag
* @param path

@@ -58,3 +64,3 @@ */

pageview(path) {
window.gtag('event', 'page_view', {
return this.gtag('event', 'page_view', {
page_path: path,

@@ -66,2 +72,22 @@ page_location: window.location,

/**
* @desc set event and send to gtag
* @param action
* @param label
* @param category
* @param nonInteraction
*/
event(action, label, category, nonInteraction) {
if (nonInteraction === void 0) {
nonInteraction = false;
}
return this.gtag('event', action, {
event_label: label,
event_category: category,
non_interaction: nonInteraction
});
}
/**
* @desc direct access to gtag

@@ -73,7 +99,4 @@ * @param args

gtag() {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return window.gtag(args);
//@ts-ignore
return window.gtag(...arguments);
}

@@ -107,4 +130,6 @@

var GA4R$1 = GA4R;
export default GA4React;
export { GA4R };
export { GA4R$1 as GA4R };
//# sourceMappingURL=ga-4-react.esm.js.map

@@ -1,14 +0,4 @@

import React from 'react';
import GA4React from './ga4manager';
export interface IGAReactConfig {
send_page_view: boolean;
groups: string;
}
export interface IGA4R {
code: string;
config?: IGAReactConfig;
additionalCode?: Array<string>;
children?: any;
}
export declare const GA4R: React.FC<IGA4R>;
import GA4React from './lib/ga4manager';
import GA4RComponents from './components/GA4RComponents';
export declare const GA4R: typeof GA4RComponents;
export default GA4React;
{
"version": "0.1.22",
"version": "0.1.23",
"license": "MIT",

@@ -36,2 +36,3 @@ "main": "dist/index.js",

"author": "manueltrebbi",
"repository": "https://github.com/unrealmanu/ga-4-react",
"module": "dist/ga-4-react.esm.js",

@@ -38,0 +39,0 @@ "size-limit": [

@@ -45,5 +45,4 @@ # GA4React - Google Analytics 4 React

---
<a href="https://www.buymeacoffee.com/unrealmanu" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" style="height: 60px !important;width: 217px !important;" ></a>

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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