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

@financial-times/o-tracking

Package Overview
Dependencies
Maintainers
9
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@financial-times/o-tracking - npm Package Compare versions

Comparing version 3.1.4 to 3.2.0

10

dist-esm/javascript/core/send.js

@@ -19,3 +19,9 @@ import { get as getSetting } from "./settings.js";

function should_use_sendBeacon() {
return Boolean(navigator.sendBeacon);
var config = getSetting('config') || {};
if (config.queue === true) {
return false;
} else {
return Boolean(navigator.sendBeacon);
}
}

@@ -98,3 +104,3 @@ /**

var url = 'https://spoor-api.ft.com/ingest';
var url = 'https://spoor-api.ft.com/px.gif';

@@ -101,0 +107,0 @@ if (request && request.category && request.action) {

14

dist-esm/javascript/events/click.js

@@ -6,3 +6,2 @@ import Delegate from "ftdomdelegate";

import { getTrace } from "../../libs/get-trace.js";
import { Queue } from "../core/queue.js";
var delegate;

@@ -72,16 +71,5 @@ var eventPropertiesToCollect = ["ctrlKey", "altKey", "shiftKey", "metaKey"]; // Get properties for the event (as opposed to properties of the clicked element)

delegate = delegate || new Delegate(document.body);
delegate.on('click', elementsToTrack, handleClickEvent(eventData), true); // Fire all click events that were stored in the old queue used by o-tracking v2
var clickQueue = new Queue('clicks');
sendAllEventsFromQueue(clickQueue);
delegate.on('click', elementsToTrack, handleClickEvent(eventData), true);
};
function sendAllEventsFromQueue(queue) {
var nextLink = queue.shift();
if (nextLink) {
core.track(nextLink, () => sendAllEventsFromQueue(queue));
}
}
var click = {

@@ -88,0 +76,0 @@ init

@@ -6,6 +6,6 @@ "use strict";

});
exports.add = add;
exports.addAndRun = addAndRun;
exports.init = init;
exports.add = add;
exports.run = run;
exports.addAndRun = addAndRun;

@@ -33,3 +33,9 @@ var _settings = require("./settings.js");

function should_use_sendBeacon() {
return Boolean(navigator.sendBeacon);
var config = (0, _settings.get)('config') || {};
if (config.queue === true) {
return false;
} else {
return Boolean(navigator.sendBeacon);
}
}

@@ -112,3 +118,3 @@ /**

var url = 'https://spoor-api.ft.com/ingest';
var url = 'https://spoor-api.ft.com/px.gif';

@@ -115,0 +121,0 @@ if (request && request.category && request.action) {

@@ -6,4 +6,4 @@ "use strict";

});
exports.init = init;
exports.session = getSession;
exports.init = init;

@@ -10,0 +10,0 @@ var _utils = require("../utils.js");

@@ -7,3 +7,3 @@ "use strict";

exports.destroy = destroy;
exports.get = exports.set = void 0;
exports.set = exports.get = void 0;
var settings = {

@@ -10,0 +10,0 @@ config: {}

@@ -7,8 +7,9 @@ "use strict";

exports.get = get;
Object.defineProperty(exports, "xhr", {
Object.defineProperty(exports, "image", {
enumerable: true,
get: function get() {
return _xhr.xhr;
return _image.image;
}
});
exports.mock = void 0;
Object.defineProperty(exports, "sendBeacon", {

@@ -20,9 +21,8 @@ enumerable: true,

});
Object.defineProperty(exports, "image", {
Object.defineProperty(exports, "xhr", {
enumerable: true,
get: function get() {
return _image.image;
return _xhr.xhr;
}
});
exports.mock = void 0;

@@ -29,0 +29,0 @@ var _xhr = require("./xhr.js");

@@ -6,6 +6,6 @@ "use strict";

});
exports.destroy = destroy;
exports.init = init;
exports.setUser = setUser;
exports.userID = id;
exports.destroy = destroy;

@@ -12,0 +12,0 @@ var _utils = require("../utils.js");

@@ -18,4 +18,2 @@ "use strict";

var _queue = require("../core/queue.js");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -88,16 +86,5 @@

delegate = delegate || new _ftdomdelegate.default(document.body);
delegate.on('click', elementsToTrack, handleClickEvent(eventData), true); // Fire all click events that were stored in the old queue used by o-tracking v2
var clickQueue = new _queue.Queue('clicks');
sendAllEventsFromQueue(clickQueue);
delegate.on('click', elementsToTrack, handleClickEvent(eventData), true);
};
function sendAllEventsFromQueue(queue) {
var nextLink = queue.shift();
if (nextLink) {
_core.default.track(nextLink, () => sendAllEventsFromQueue(queue));
}
}
var click = {

@@ -104,0 +91,0 @@ init

@@ -6,18 +6,11 @@ "use strict";

});
exports.log = log;
exports.isUndefined = exports.is = is;
exports.merge = merge;
exports.encode = encode;
exports.decode = decode;
exports.addEvent = addEvent;
exports.assignIfUndefined = assignIfUndefined;
exports.broadcast = broadcast;
exports.onPage = onPage;
exports.triggerPage = triggerPage;
exports.getValueFromCookie = getValueFromCookie;
exports.sanitise = sanitise;
exports.assignIfUndefined = assignIfUndefined;
exports.containsCircularPaths = containsCircularPaths;
exports.decode = decode;
exports.encode = encode;
exports.filterProperties = filterProperties;
exports.findCircularPathsIn = findCircularPathsIn;
exports.containsCircularPaths = containsCircularPaths;
exports.isDeepEqual = isDeepEqual;
exports.getValueFromCookie = getValueFromCookie;
Object.defineProperty(exports, "guid", {

@@ -29,2 +22,9 @@ enumerable: true,

});
exports.isUndefined = exports.is = is;
exports.isDeepEqual = isDeepEqual;
exports.log = log;
exports.merge = merge;
exports.onPage = onPage;
exports.sanitise = sanitise;
exports.triggerPage = triggerPage;

@@ -31,0 +31,0 @@ var _settings = require("./core/settings.js");

@@ -16,3 +16,3 @@ {

"name": "@financial-times/o-tracking",
"version": "3.1.4",
"version": "3.2.0",
"description": "Origami module for FT tracking.",

@@ -19,0 +19,0 @@ "dependencies": {

@@ -61,2 +61,18 @@ # o-tracking

### Turning on offline support and queueing events
By default o-tracking uses the browser Beacon API to send events to Spoor and the Beacon API only works when the device is online and o-tracking can not queue those events.
If wanting to queue events (to retry them if they failed to send) and/or wanting to record events when offline, set `queue` to `true` during the intialisation of `o-tracking` like so:
```js
import oTracking from 'o-tracking';
const config = {
queue: true, // Make sure o-tracking stores the events on a local queue (this means o-tracking can work when the device is offline)
...
};
oTracking.init(config);
```
#### Developer/Test Mode

@@ -63,0 +79,0 @@

@@ -19,3 +19,8 @@ import {get as getSetting} from './settings.js';

function should_use_sendBeacon() {
return Boolean(navigator.sendBeacon);
let config = getSetting('config') || {};
if (config.queue === true) {
return false;
} else {
return Boolean(navigator.sendBeacon);
}
}

@@ -100,3 +105,3 @@

*/
let url = 'https://spoor-api.ft.com/ingest';
let url = 'https://spoor-api.ft.com/px.gif';

@@ -103,0 +108,0 @@ if (request && request.category && request.action) {

@@ -6,3 +6,2 @@ import Delegate from 'ftdomdelegate';

import {getTrace} from '../../libs/get-trace.js';
import { Queue } from '../core/queue.js';

@@ -77,15 +76,4 @@ let delegate;

delegate.on('click', elementsToTrack, handleClickEvent(eventData), true);
// Fire all click events that were stored in the old queue used by o-tracking v2
const clickQueue = new Queue('clicks');
sendAllEventsFromQueue(clickQueue);
};
function sendAllEventsFromQueue(queue) {
const nextLink = queue.shift();
if (nextLink) {
core.track(nextLink, () => sendAllEventsFromQueue(queue));
}
}
const click = {

@@ -92,0 +80,0 @@ init

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