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

@ludens-reklame/profiler-client

Package Overview
Dependencies
Maintainers
9
Versions
61
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ludens-reklame/profiler-client - npm Package Compare versions

Comparing version 2.4.1 to 2.5.0

5

dist/Profiler.d.ts
interface Opts {
organization: string;
personalize?: boolean;
dataPointSetDelay?: number;
}

@@ -70,5 +71,7 @@ interface UpdateProfileOpts {

private personalize;
private dpDelay;
private pid?;
private sid?;
private pageView?;
private dpDelayTimerId?;
constructor(opts: Opts);

@@ -82,3 +85,3 @@ updateProfile(opts: UpdateProfileOpts): Promise<void>;

collect(opts: CollectOpts): Promise<Response>;
readMeta(): Promise<void>;
readMeta(): void;
newPageView(opts?: PageViewOpts): void;

@@ -85,0 +88,0 @@ private handlePersonalizations;

64

dist/Profiler.js

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

var COOKIE_SID_KEY = '__psid';
var DEFAULT_DP_DELAY = 10000;
var Profiler = /** @class */ (function () {

@@ -50,6 +51,6 @@ function Profiler(opts) {

this.personalize = opts.personalize || false;
this.dpDelay = opts.dataPointSetDelay || DEFAULT_DP_DELAY;
this.readPidFromCookie();
this.readSidFromCookie();
this.handlePersonalizations();
this.readMeta();
this.newSession();

@@ -256,36 +257,29 @@ this.newPageView();

Profiler.prototype.readMeta = function () {
return __awaiter(this, void 0, void 0, function () {
var metas, dpsToPush, i, meta, contents, j, contentArr, ref, weight;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
if (!(window && document)) return [3 /*break*/, 2];
metas = document.getElementsByTagName('meta');
dpsToPush = [];
for (i = 0; i < metas.length; i++) {
meta = metas[i];
if (meta.getAttribute('name') === 'profiler:interests') {
contents = (meta.getAttribute('content') || '').split(',');
for (j = 0; j < contents.length; j++) {
contentArr = contents[j].split(':');
if (contentArr.length > 0) {
ref = contentArr[0];
weight = contentArr.length > 1 ? parseInt(contentArr[1]) : undefined;
dpsToPush.push({
dataPoint: ref,
value: weight
});
}
}
}
var _this = this;
if (window && document) {
var metas = document.getElementsByTagName('meta');
var dpsToPush_1 = [];
for (var i = 0; i < metas.length; i++) {
var meta = metas[i];
if (meta.getAttribute('name') === 'profiler:interests') {
var contents = (meta.getAttribute('content') || '').split(',');
for (var j = 0; j < contents.length; j++) {
var contentArr = contents[j].split(':');
if (contentArr.length > 0) {
var ref = contentArr[0];
var weight = contentArr.length > 1 ? parseInt(contentArr[1]) : undefined;
dpsToPush_1.push({
dataPoint: ref,
value: weight
});
}
if (!(dpsToPush.length > 0)) return [3 /*break*/, 2];
return [4 /*yield*/, this.pushDataPoints({ dataPoints: dpsToPush })];
case 1:
_a.sent();
_a.label = 2;
case 2: return [2 /*return*/];
}
}
});
});
}
if (dpsToPush_1.length > 0 && window) {
this.dpDelayTimerId = window.setTimeout(function () {
_this.pushDataPoints({ dataPoints: dpsToPush_1 });
}, this.dpDelay);
}
}
};

@@ -300,2 +294,6 @@ Profiler.prototype.newPageView = function (opts) {

};
if (!!this.dpDelayTimerId && window) {
window.clearInterval(this.dpDelayTimerId);
}
this.readMeta();
};

@@ -302,0 +300,0 @@ Profiler.prototype.handlePersonalizations = function () {

{
"name": "@ludens-reklame/profiler-client",
"version": "2.4.1",
"version": "2.5.0",
"description": "Profiler for all",

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

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