@waves/event-sender
Advanced tools
Comparing version 0.5.0 to 0.5.2
@@ -12,3 +12,3 @@ (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){ | ||
bus.on('has-referrer', function (referrer) { | ||
Object.defineProperty(document, 'referrer', { | ||
Object.defineProperty(Document.prototype, 'referrer', { | ||
get: function () { return referrer; } | ||
@@ -15,0 +15,0 @@ }); |
{ | ||
"name": "@waves/event-sender", | ||
"version": "0.5.0", | ||
"version": "0.5.2", | ||
"description": "An interface for sending analytics events from Waves JS applications", | ||
@@ -5,0 +5,0 @@ "main": "dist/analytics.js", |
@@ -5,48 +5,1 @@ ## Event Sender | ||
--- | ||
Usage: | ||
```javascript | ||
import EventSender from '@waves/event-sender'; | ||
// EventSender is a singleton, so any new attemps at instantiation | ||
// will return a reference to a previously created instance | ||
const sender = new EventSender(); | ||
// E.g. | ||
const sender2 = new EventSender(); | ||
sender === sender2 // true | ||
// Static method .inactive() returns an instance of EventSender that queues events, | ||
// but does not send them until .activate() method is called | ||
const sender = EventSender.inactive(); | ||
// (!) If an EventSender instance has been activated before, this will | ||
// return a reference to it, so it WILL be active. | ||
/** Queue custom event */ | ||
sender.push('Product', 'GetClientClick', 'my_custom_label', 2.0); | ||
/** | ||
* Queue page view | ||
* Useful for SPA page transitions when no | ||
* pageView event is tracked by default. | ||
*/ | ||
sender.pushPageView(window.location.href, document.referrer); | ||
// Enables sending events, including those queued before. | ||
sender.activate(); | ||
// EventSender methods are chainable: | ||
sender | ||
.activate() | ||
.push('Product', 'GetClientClick', 'my_custom_label', 2.0) | ||
.pushPageView(window.location.href, document.referrer) | ||
.push('Home', 'Subscribe'); | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
31292
5
1