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.7.3 to 1.8.0

2

package.json
{
"name": "zmp-ga4",
"version": "1.7.3",
"version": "1.8.0",
"author": {

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

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

this.collect = function () {
var _a;
if (_this.userId) {

@@ -71,12 +70,5 @@ if (_this.eventQueue.length) {

method: "POST",
mode: "cors",
body: JSON.stringify({
client_id: (_a = _this.options.clientId) !== null && _a !== void 0 ? _a : _this.propertyId,
events: _this.eventQueue.map(function (_a) {
var name = _a.name, params = _a.params;
return ({
name: name,
params: __assign(__assign({}, params), { session_id: _this.userId })
});
})
client_id: _this.userId,
events: _this.eventQueue
})

@@ -93,2 +85,3 @@ })["catch"]();

this.getVisitorID().then(function (visitorId) { return (_this.userId = visitorId); });
this.sessionId = this.uuidv4();
window.addEventListener("beforeunload", this.collect);

@@ -197,3 +190,3 @@ var handleLocationChange = function () {

name: action,
params: __assign({ engagement_time_msec: String(Math.round(performance.now() - this.startTime)), protocol: location.protocol }, params)
params: __assign({ session_id: this.sessionId, engagement_time_msec: String(Math.round(performance.now() - this.startTime)), protocol: location.protocol }, params)
});

@@ -200,0 +193,0 @@ clearTimeout(this.timeout);

export class AdaptiveAnalytics {
private userId: string;
private sessionId: string;
private startTime = performance.now();

@@ -14,3 +15,2 @@ private eventQueue: {

private options: {
clientId?: string;
useMeasurementProtocolWhen: () => boolean;

@@ -26,2 +26,3 @@ gtagConfig?: Record<string, unknown>;

this.getVisitorID().then((visitorId) => (this.userId = visitorId));
this.sessionId = this.uuidv4();
window.addEventListener("beforeunload", this.collect);

@@ -135,12 +136,5 @@

method: "POST",
mode: "cors",
body: JSON.stringify({
client_id: this.options.clientId ?? this.propertyId,
events: this.eventQueue.map(({ name, params }) => ({
name,
params: {
...params,
session_id: this.userId,
},
})),
client_id: this.userId,
events: this.eventQueue,
}),

@@ -161,2 +155,3 @@ }

params: {
session_id: this.sessionId,
engagement_time_msec: String(

@@ -163,0 +158,0 @@ Math.round(performance.now() - this.startTime)

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