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

zmp-ga4

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

zmp-ga4 - npm Package Compare versions

Comparing version 1.1.0 to 1.2.0

2

package.json
{
"name": "zmp-ga4",
"version": "1.1.0",
"version": "1.2.0",
"author": {

@@ -5,0 +5,0 @@ "name": "Nguyễn Hồng Phát",

@@ -80,8 +80,26 @@ "use strict";

window.addEventListener("beforeunload", this.collect);
window.addEventListener("popstate", function () {
var handleLocationChange = function () {
_this.trackEvent("page_view", {
page_path: location.pathname,
page_params: location.search
page_params: location.search,
page_title: document.title
});
});
};
handleLocationChange();
window.addEventListener("popstate", handleLocationChange);
// Replace history.pushState to dispatch a custom event
var originalPushState_1 = history.pushState;
history.pushState = function () {
originalPushState_1.apply(this, arguments);
window.dispatchEvent(new Event("pushstate"));
};
// Replace history.replaceState to dispatch a custom event
var originalReplaceState_1 = history.replaceState;
history.replaceState = function () {
originalReplaceState_1.apply(this, arguments);
window.dispatchEvent(new Event("replacestate"));
};
// Add event listeners for pushstate and replacestate events
window.addEventListener("pushstate", handleLocationChange);
window.addEventListener("replacestate", handleLocationChange);
}

@@ -88,0 +106,0 @@ else {

@@ -24,8 +24,29 @@ export class AdaptiveAnalytics {

window.addEventListener("beforeunload", this.collect);
window.addEventListener("popstate", () => {
const handleLocationChange = () => {
this.trackEvent("page_view", {
page_path: location.pathname,
page_params: location.search,
page_title: document.title,
});
});
};
handleLocationChange();
window.addEventListener("popstate", handleLocationChange);
// Replace history.pushState to dispatch a custom event
const originalPushState = history.pushState;
history.pushState = function () {
originalPushState.apply(this, arguments);
window.dispatchEvent(new Event("pushstate"));
};
// Replace history.replaceState to dispatch a custom event
const originalReplaceState = history.replaceState;
history.replaceState = function () {
originalReplaceState.apply(this, arguments);
window.dispatchEvent(new Event("replacestate"));
};
// Add event listeners for pushstate and replacestate events
window.addEventListener("pushstate", handleLocationChange);
window.addEventListener("replacestate", handleLocationChange);
} else {

@@ -32,0 +53,0 @@ this.loadScript(

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