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

ga4-mp

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

ga4-mp - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

2

dist/index.d.ts

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

export { sayHello, sayGoodbye } from "./library";
export * from "./library";
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.sayGoodbye = exports.sayHello = void 0;
var library_1 = require("./library");
Object.defineProperty(exports, "sayHello", { enumerable: true, get: function () { return library_1.sayHello; } });
Object.defineProperty(exports, "sayGoodbye", { enumerable: true, get: function () { return library_1.sayGoodbye; } });
__exportStar(require("./library"), exports);

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

export declare function sayHello(): void;
export declare function sayGoodbye(): void;
export declare function setClient(apiSecret: any, measurementId: any, clientId: any): void;
export declare function readClient(): void;
export declare function sendHit(events: any): void;
export declare function testSendHit(events: any): void;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.sayGoodbye = exports.sayHello = void 0;
function sayHello() {
console.log("Hi");
exports.testSendHit = exports.sendHit = exports.readClient = exports.setClient = void 0;
const axios = require('axios');
var API_SECRET;
var MEASUREMENT_ID;
var CLIENT_ID;
var GA_ENDPOINT;
var TEST_ENDPOINT;
function setClient(apiSecret, measurementId, clientId) {
API_SECRET = apiSecret;
MEASUREMENT_ID = measurementId;
CLIENT_ID = clientId;
GA_ENDPOINT = `https://www.google-analytics.com/mp/collect?measurement_id=${MEASUREMENT_ID}&api_secret=${API_SECRET}`;
TEST_ENDPOINT = `https://www.google-analytics.com/debug/mp/collect?measurement_id=${MEASUREMENT_ID}&api_secret=${API_SECRET}`;
}
exports.sayHello = sayHello;
function sayGoodbye() {
console.log("Bye");
exports.setClient = setClient;
function readClient() {
console.log("API_SECRET: " + API_SECRET);
console.log("MEASUREMENT_ID: " + MEASUREMENT_ID);
console.log("CLIENT_ID: " + CLIENT_ID);
console.log("GA_ENDPOINT: " + GA_ENDPOINT);
console.log("TEST_ENDPOINT: " + TEST_ENDPOINT);
}
exports.sayGoodbye = sayGoodbye;
exports.readClient = readClient;
/*
SendHit: events must match the array format:
// [{
name: 'tutorial_begin',
params: {},
},{
name: 'tutorial_complete',
params: {},
}]
Can send up to 25 events at once
*/
function sendHit(events) {
axios.post(GA_ENDPOINT, {
client_id: CLIENT_ID,
events: events
}).then(res => {
console.log(`statusCode: ${res.statusCode}`);
console.log(res);
}).catch(error => {
console.log(error);
});
}
exports.sendHit = sendHit;
function testSendHit(events) {
axios.post(TEST_ENDPOINT, {
client_id: CLIENT_ID,
events: events
}).then(res => {
console.log(`statusCode: ${res.statusCode}`);
console.log(res);
}).catch(error => {
console.log(error);
});
}
exports.testSendHit = testSendHit;
{
"name": "ga4-mp",
"version": "1.0.0",
"version": "1.0.1",
"description": "Send data to Google Analytics 4 using Measurement Protocol",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"directories": {
"test": "test"
},
"directories": {},
"scripts": {

@@ -26,3 +24,8 @@ "test": "echo \"Error: no test specified\" && exit 1"

"author": "Zach Mitchell",
"license": "SEE LICENSE IN GA4-Measurement-Protocol-Typescript/LICENSE"
"license": "SEE LICENSE IN GA4-Measurement-Protocol-Typescript/LICENSE",
"dependencies": {
"@types/node": "^14.14.6",
"axios": "^0.21.0",
"http": "0.0.1-security"
}
}
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