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

lachie-ga4

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lachie-ga4 - npm Package Compare versions

Comparing version 2.0.1 to 2.1.0

8

dist/ga4.js

@@ -103,2 +103,3 @@ "use strict";

_defineProperty(this, "_loadGA", function (GA_MEASUREMENT_ID, nonce) {
var gtagUrl = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "https://an4.cryptotaxcalculator.io/gtag/js";
if (typeof window === "undefined" || typeof document === "undefined") {

@@ -111,3 +112,3 @@ return;

script.async = true;
script.src = "https://an4.cryptotaxcalculator.io/js?id=".concat(GA_MEASUREMENT_ID);
script.src = "".concat(gtagUrl, "?id=").concat(GA_MEASUREMENT_ID);
if (nonce) {

@@ -178,6 +179,7 @@ script.setAttribute("nonce", nonce);

_options$testMode = options.testMode,
testMode = _options$testMode === void 0 ? false : _options$testMode;
testMode = _options$testMode === void 0 ? false : _options$testMode,
gtagUrl = options.gtagUrl;
_this._testMode = testMode;
if (!testMode) {
_this._loadGA(_this._currentMeasurementId, nonce);
_this._loadGA(_this._currentMeasurementId, nonce, gtagUrl);
}

@@ -184,0 +186,0 @@ if (!_this.isInitialized) {

{
"name": "lachie-ga4",
"version": "2.0.1",
"version": "2.1.0",
"description": "React Google Analytics 4 (that allows gtag URL to be customised)",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -43,3 +43,3 @@ # React Google Analytics 4

// Send pageview with a custom path
ReactGA.send({ hitType: "pageview", page: "/my-path" });
ReactGA.send({ hitType: "pageview", page: "/my-path", title: "Custom Title" });

@@ -66,2 +66,3 @@ // Send a custom event

| options.testMode | `boolean` Default false |
| options.gtagUrl | `string` Default `https://an4.cryptotaxcalculator.io/gtag/js` |
| options.gaOptions | `object` Optional [Reference](https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference) |

@@ -68,0 +69,0 @@ | options.gtagOptions | `object` Optional |

@@ -81,3 +81,7 @@ import gtag from "./gtag";

_loadGA = (GA_MEASUREMENT_ID, nonce) => {
_loadGA = (
GA_MEASUREMENT_ID,
nonce,
gtagUrl = "https://an4.cryptotaxcalculator.io/gtag/js"
) => {
if (typeof window === "undefined" || typeof document === "undefined") {

@@ -91,3 +95,3 @@ return;

script.async = true;
script.src = `https://an4.cryptotaxcalculator.io/js?id=${GA_MEASUREMENT_ID}`;
script.src = `${gtagUrl}?id=${GA_MEASUREMENT_ID}`;
if (nonce) {

@@ -158,2 +162,3 @@ script.setAttribute("nonce", nonce);

* @param {boolean} [options.testMode=false]
* @param {string} [options.gtagUrl=https://an4.cryptotaxcalculator.io/gtag/js]
* @param {GaOptions|any} [options.gaOptions]

@@ -173,7 +178,13 @@ * @param {Object} [options.gtagOptions] New parameter

this._currentMeasurementId = initConfigs[0].trackingId;
const { gaOptions, gtagOptions, nonce, testMode = false } = options;
const {
gaOptions,
gtagOptions,
nonce,
testMode = false,
gtagUrl,
} = options;
this._testMode = testMode;
if (!testMode) {
this._loadGA(this._currentMeasurementId, nonce);
this._loadGA(this._currentMeasurementId, nonce, gtagUrl);
}

@@ -180,0 +191,0 @@ if (!this.isInitialized) {

@@ -47,3 +47,3 @@ /**

gtag(...args: any[]): void;
_loadGA: (GA_MEASUREMENT_ID: any, nonce: any) => void;
_loadGA: (GA_MEASUREMENT_ID: any, nonce: any, gtagUrl?: string) => void;
_toGtagOptions: (gaOptions: any) => {};

@@ -56,2 +56,3 @@ /**

* @param {boolean} [options.testMode=false]
* @param {string} [options.gtagUrl=https://an4.cryptotaxcalculator.io/gtag/js]
* @param {GaOptions|any} [options.gaOptions]

@@ -63,2 +64,3 @@ * @param {Object} [options.gtagOptions] New parameter

testMode?: boolean;
gtagUrl?: string;
gaOptions?: GaOptions | any;

@@ -65,0 +67,0 @@ gtagOptions?: any;

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