@analytics/snowplow
Advanced tools
Comparing version 0.2.3 to 0.2.4
@@ -6,2 +6,10 @@ # Change Log | ||
## [0.2.4](https://github.com/DavidWells/analytics/compare/@analytics/snowplow@0.2.3...@analytics/snowplow@0.2.4) (2021-03-14) | ||
**Note:** Version bump only for package @analytics/snowplow | ||
## [0.2.3](https://github.com/DavidWells/analytics/compare/@analytics/snowplow@0.2.2...@analytics/snowplow@0.2.3) (2021-01-14) | ||
@@ -8,0 +16,0 @@ |
@@ -38,3 +38,3 @@ var analyticsSnowplow = (function () { | ||
if (i % 2) { | ||
ownKeys(Object(source), true).forEach(function (key) { | ||
ownKeys(source, true).forEach(function (key) { | ||
_defineProperty(target, key, source[key]); | ||
@@ -45,3 +45,3 @@ }); | ||
} else { | ||
ownKeys(Object(source)).forEach(function (key) { | ||
ownKeys(source).forEach(function (key) { | ||
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); | ||
@@ -64,63 +64,64 @@ }); | ||
} | ||
/** | ||
* Snowplow analytics integration | ||
* @link https://getanalytics.io/plugins/snowplow/ | ||
* @link https://docs.snowplowanalytics.com/docs/collecting-data/collecting-from-own-applications/javascript-tracker/ | ||
* @param {Object} pluginConfig - Plugin settings | ||
* @param {string} pluginConfig.scriptSrc - Self-hosted Snowplow sp.js file location | ||
* @param {string} pluginConfig.collectorUrl - The URL to a Snowplow collector | ||
* @param {string} [pluginConfig.name] - The name to identify this instance of the tracker, use if using multiple tracker instances ('snowplow' default) | ||
* @param {Object} [pluginConfig.trackerSettings] - The arg map to pass to the Snowplow Tracker | ||
* @param {string} [pluginConfig.trackerSettings.appId] - The appId to identify this application | ||
* @param {string} [pluginConfig.trackerSettings.platform] - Platform of tracking ("web" default) | ||
* @param {string} [pluginConfig.trackerSettings.cookieDomain] - Domain to set cookie against | ||
* @param {string} [pluginConfig.trackerSettings.discoverRootDomain] - Automatically discover root domain | ||
* @param {string} [pluginConfig.trackerSettings.cookieName] - Prefix for cookies ("_sp_" default) | ||
* @param {string} [pluginConfig.trackerSettings.cookieSameSite] - SameSite cookie setting ("None" default) | ||
* @param {boolean} [pluginConfig.trackerSettings.cookieSecure] - Secure cookie setting (true default) | ||
* @param {boolean} [pluginConfig.trackerSettings.encodeBase64] - Encode JSON objects as Base64 (true default) | ||
* @param {bolean} [pluginConfig.trackerSettings.respectDoNotTrack] - Respect do not track (consider analytics-plugin-do-not-track) (false default) | ||
* @param {number} [pluginConfig.trackerSettings.pageUnloadTimer] - Timeout in ms to block page navigation until buffer is empty (500 default) | ||
* @param {boolean} [pluginConfig.trackerSettings.forceSecureTracker] - Forces requests to be sent https (false default) | ||
* @param {string} [pluginConfig.trackerSettings.eventMethod] - Method to send events, GET, POST, Beacon (POST default) | ||
* @param {number} [pluginConfig.trackerSettings.bufferSize] - Amount of events to buffer before sending (1 default) | ||
* @param {number} [pluginConfig.trackerSettings.maxPostBytes] - Maximum size of POST or Beacon before sending (40000 default) | ||
* @param {string} [pluginConfig.trackerSettings.crossDomainLinker] - function to configure which links to add cross domain linking | ||
* @param {number} [pluginConfig.trackerSettings.cookieLifetime] - Cookie lifetime (63072000 default) | ||
* @param {string} [pluginConfig.trackerSettings.stateStorageStrategy] - Use cookies and/or localstorage ("cookieAndLocalStorage" default) | ||
* @param {number} [pluginConfig.trackerSettings.maxLocalStorageQueueSize] - Maximum numbers of events to buffer in localstorage to prevent filling local storage (1000 default) | ||
* @param {boolean} [pluginConfig.trackerSettings.resetActivityTrackingOnPageView] - Flag to decide whether to reset page ping timers on virtual page view (true default) | ||
* @param {boolean} [pluginConfig.trackerSettings.connectionTimeout] - The timeout, in milliseconds, before GET and POST requests will timeout (5000 default) (Snowplow JS 2.15.0+) | ||
* @param {string[]} [pluginConfig.trackerSettings.skippedBrowserFeatures] - Array to skip browser feature collection ([] default) (Snowplow JS 2.15.0+) | ||
* @param {(Object|boolean)} [pluginConfig.trackerSettings.anonymousTracking] - Flag to enable anonymous tracking functionality (false default) | ||
* @param {boolean} [pluginConfig.trackerSettings.anonymousTracking.withSessionTracking] - Flag to enable whether to continue tracking sessions in anonymous tracking mode (false default) | ||
* @param {boolean} [pluginConfig.trackerSettings.anonymousTracking.withServerAnonymisation] - Flag which prevents collector from returning and capturing cookies and capturing ip address (false default) | ||
* @param {Object} [pluginConfig.trackerSettings.contexts] - The auto contexts for each event | ||
* @param {boolean} [pluginConfig.trackerSettings.contexts.webPage] - The webpage context, containing the page view id. (true default) | ||
* @param {boolean} [pluginConfig.trackerSettings.contexts.performanceTiming] - Add performance timing information | ||
* @param {(Object|boolean)} [pluginConfig.trackerSettings.contexts.clientHints] - Add Client Hint information (Snowplow JS 2.15.0+) | ||
* @param {boolean} [pluginConfig.trackerSettings.contexts.clientHints.includeHighEntropy] - Capture High Entropy Client Hints (Snowplow JS 2.15.0+) | ||
* @param {boolean} [pluginConfig.trackerSettings.contexts.gaCookies] - Add gaCookie information | ||
* @param {boolean} [pluginConfig.trackerSettings.contexts.geolocation] - Add browser geolocation information | ||
* @param {boolean} [pluginConfig.trackerSettings.contexts.optimizelyXSummary] - Add browser geolocation information | ||
* @return {Object} Analytics plugin | ||
* | ||
* @example | ||
* | ||
* // Minimal recommended configuration | ||
* snowplowPlugin({ | ||
* name: 'snowplow', | ||
* scriptSrc: '//*.cloudfront.net/2.17.0/sp.js', | ||
* collectorUrl: 'collector.mysite.com', | ||
* trackerSettings: { | ||
* appId: 'myApp', | ||
* contexts: { | ||
* webPage: true | ||
* } | ||
* } | ||
* }) | ||
*/ | ||
}; | ||
/** | ||
* Snowplow analytics integration | ||
* @link https://getanalytics.io/plugins/snowplow/ | ||
* @link https://docs.snowplowanalytics.com/docs/collecting-data/collecting-from-own-applications/javascript-tracker/ | ||
* @param {Object} pluginConfig - Plugin settings | ||
* @param {string} pluginConfig.scriptSrc - Self-hosted Snowplow sp.js file location | ||
* @param {string} pluginConfig.collectorUrl - The URL to a Snowplow collector | ||
* @param {string} [pluginConfig.name] - The name to identify this instance of the tracker, use if using multiple tracker instances ('snowplow' default) | ||
* @param {Object} [pluginConfig.trackerSettings] - The arg map to pass to the Snowplow Tracker | ||
* @param {string} [pluginConfig.trackerSettings.appId] - The appId to identify this application | ||
* @param {string} [pluginConfig.trackerSettings.platform] - Platform of tracking ("web" default) | ||
* @param {string} [pluginConfig.trackerSettings.cookieDomain] - Domain to set cookie against | ||
* @param {string} [pluginConfig.trackerSettings.discoverRootDomain] - Automatically discover root domain | ||
* @param {string} [pluginConfig.trackerSettings.cookieName] - Prefix for cookies ("_sp_" default) | ||
* @param {string} [pluginConfig.trackerSettings.cookieSameSite] - SameSite cookie setting ("None" default) | ||
* @param {boolean} [pluginConfig.trackerSettings.cookieSecure] - Secure cookie setting (true default) | ||
* @param {boolean} [pluginConfig.trackerSettings.encodeBase64] - Encode JSON objects as Base64 (true default) | ||
* @param {bolean} [pluginConfig.trackerSettings.respectDoNotTrack] - Respect do not track (consider analytics-plugin-do-not-track) (false default) | ||
* @param {number} [pluginConfig.trackerSettings.pageUnloadTimer] - Timeout in ms to block page navigation until buffer is empty (500 default) | ||
* @param {boolean} [pluginConfig.trackerSettings.forceSecureTracker] - Forces requests to be sent https (false default) | ||
* @param {string} [pluginConfig.trackerSettings.eventMethod] - Method to send events, GET, POST, Beacon (POST default) | ||
* @param {number} [pluginConfig.trackerSettings.bufferSize] - Amount of events to buffer before sending (1 default) | ||
* @param {number} [pluginConfig.trackerSettings.maxPostBytes] - Maximum size of POST or Beacon before sending (40000 default) | ||
* @param {string} [pluginConfig.trackerSettings.crossDomainLinker] - function to configure which links to add cross domain linking | ||
* @param {number} [pluginConfig.trackerSettings.cookieLifetime] - Cookie lifetime (63072000 default) | ||
* @param {string} [pluginConfig.trackerSettings.stateStorageStrategy] - Use cookies and/or localstorage ("cookieAndLocalStorage" default) | ||
* @param {number} [pluginConfig.trackerSettings.maxLocalStorageQueueSize] - Maximum numbers of events to buffer in localstorage to prevent filling local storage (1000 default) | ||
* @param {boolean} [pluginConfig.trackerSettings.resetActivityTrackingOnPageView] - Flag to decide whether to reset page ping timers on virtual page view (true default) | ||
* @param {boolean} [pluginConfig.trackerSettings.connectionTimeout] - The timeout, in milliseconds, before GET and POST requests will timeout (5000 default) (Snowplow JS 2.15.0+) | ||
* @param {string[]} [pluginConfig.trackerSettings.skippedBrowserFeatures] - Array to skip browser feature collection ([] default) (Snowplow JS 2.15.0+) | ||
* @param {(Object|boolean)} [pluginConfig.trackerSettings.anonymousTracking] - Flag to enable anonymous tracking functionality (false default) | ||
* @param {boolean} [pluginConfig.trackerSettings.anonymousTracking.withSessionTracking] - Flag to enable whether to continue tracking sessions in anonymous tracking mode (false default) | ||
* @param {boolean} [pluginConfig.trackerSettings.anonymousTracking.withServerAnonymisation] - Flag which prevents collector from returning and capturing cookies and capturing ip address (false default) | ||
* @param {Object} [pluginConfig.trackerSettings.contexts] - The auto contexts for each event | ||
* @param {boolean} [pluginConfig.trackerSettings.contexts.webPage] - The webpage context, containing the page view id. (true default) | ||
* @param {boolean} [pluginConfig.trackerSettings.contexts.performanceTiming] - Add performance timing information | ||
* @param {(Object|boolean)} [pluginConfig.trackerSettings.contexts.clientHints] - Add Client Hint information (Snowplow JS 2.15.0+) | ||
* @param {boolean} [pluginConfig.trackerSettings.contexts.clientHints.includeHighEntropy] - Capture High Entropy Client Hints (Snowplow JS 2.15.0+) | ||
* @param {boolean} [pluginConfig.trackerSettings.contexts.gaCookies] - Add gaCookie information | ||
* @param {boolean} [pluginConfig.trackerSettings.contexts.geolocation] - Add browser geolocation information | ||
* @param {boolean} [pluginConfig.trackerSettings.contexts.optimizelyXSummary] - Add browser geolocation information | ||
* @return {Object} Analytics plugin | ||
* | ||
* @example | ||
* | ||
* // Minimal recommended configuration | ||
* snowplowPlugin({ | ||
* name: 'snowplow', | ||
* scriptSrc: '//*.cloudfront.net/2.17.0/sp.js', | ||
* collectorUrl: 'collector.mysite.com', | ||
* trackerSettings: { | ||
* appId: 'myApp', | ||
* contexts: { | ||
* webPage: true | ||
* } | ||
* } | ||
* }) | ||
*/ | ||
function snowplowPlugin() { | ||
function snowplowPlugin$1() { | ||
var pluginConfig = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
@@ -468,4 +469,4 @@ | ||
case 'adconversion': | ||
snowplow("trackAdConversion:".concat(name), properties.conversionId, properties.cost, properties.category, properties.action, properties.property, properties.initialValue, // how much the conversion is initially worth | ||
properties.advertiserId, properties.costModel, properties.campaignId, properties.contexts); | ||
snowplow("trackAdConversion:".concat(name), properties.conversionId, properties.costModel, properties.cost, properties.category, properties.action, properties.property, properties.initialValue, // how much the conversion is initially worth | ||
properties.advertiserId, properties.campaignId, properties.contexts); | ||
break; | ||
@@ -482,3 +483,3 @@ | ||
case 'removefromcart': | ||
snowplow("trackRemoveToCart:".concat(name), properties.sku, properties.name, properties.category, properties.unitPrice, properties.quantity, properties.currency, properties.contexts); | ||
snowplow("trackRemoveFromCart:".concat(name), properties.sku, properties.name, properties.category, properties.unitPrice, properties.quantity, properties.currency, properties.contexts); | ||
break; | ||
@@ -594,3 +595,3 @@ | ||
var index = snowplowPlugin ; | ||
var index = snowplowPlugin$1; | ||
@@ -597,0 +598,0 @@ return index; |
@@ -1,1 +0,1 @@ | ||
var analyticsSnowplow=function(){"use strict";function e(e,n,o){return n in e?Object.defineProperty(e,n,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[n]=o,e}function n(e,n){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);n&&(t=t.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),o.push.apply(o,t)}return o}function o(o){for(var t=1;t<arguments.length;t++){var c=null!=arguments[t]?arguments[t]:{};t%2?n(Object(c),!0).forEach((function(n){e(o,n,c[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(c)):n(Object(c)).forEach((function(e){Object.defineProperty(o,e,Object.getOwnPropertyDescriptor(c,e))}))}return o}var t={name:"snowplow",trackerSettings:{contexts:{webPage:!0}}};function c(){return!window.snowplow}function a(e,n,o){if(n&&o)switch(n.toLowerCase()){case"selfdescribingevent":case"unstructevent":snowplow("trackSelfDescribingEvent:".concat(e),{schema:o.schema,data:o.data},o.contexts);break;case"socialinteraction":snowplow("trackSocialInteraction:".concat(e),o.action,o.network,o.target,o.contexts);break;case"adimpression":snowplow("trackAdImpression:".concat(e),o.impressionId,o.costModel,o.cost,o.targetUrl,o.bannerId,o.zoneId,o.advertiserId,o.campaignId,o.contexts);break;case"adclick":snowplow("trackAdClick:".concat(e),o.targetUrl,o.clickId,o.costModel,o.cost,o.bannerId,o.zoneId,o.impressionId,o.advertiserId,o.campaignId,o.contexts);break;case"adconversion":snowplow("trackAdConversion:".concat(e),o.conversionId,o.cost,o.category,o.action,o.property,o.initialValue,o.advertiserId,o.costModel,o.campaignId,o.contexts);break;case"linkclick":snowplow("trackLinkClick:".concat(e),o.targetUrl,o.elementId,o.elementClasses,o.elementTarget,o.elementContent,o.contexts);break;case"addtocart":snowplow("trackAddToCart:".concat(e),o.sku,o.name,o.category,o.unitPrice,o.quantity,o.currency,o.contexts);break;case"removefromcart":snowplow("trackRemoveToCart:".concat(e),o.sku,o.name,o.category,o.unitPrice,o.quantity,o.currency,o.contexts);break;case"sitesearch":snowplow("trackSiteSearch:".concat(e),o.searchTerms,o.filters,o.resultsFound,o.resultsDisplayed,o.contexts);break;case"consentgranted":snowplow("trackConsentGranted:".concat(e),o.id,o.version,o.name,o.description,o.expiry,o.contexts);break;case"consentwithdrawn":snowplow("trackConsentWithdrawn:".concat(e),o.all,o.id,o.version,o.name,o.description,o.contexts);break;case"error":snowplow("trackError:".concat(e),o.message,o.filename,o.lineno,o.colno,o.error,o.contexts);break;case"enhancedecommerceactioncontext":snowplow("addEnhancedEcommerceActionContext:".concat(e),o.id,o.affiliation,o.revenue,o.tax,o.shipping,o.coupon,o.list,o.step,o.option,o.currency);break;case"enhancedecommerceimpressioncontext":snowplow("addEnhancedEcommerceImpressionContext:".concat(e),o.id,o.name,o.list,o.brand,o.category,o.variant,o.position,o.price,o.currency);break;case"enhancedecommerceproductcontext":snowplow("addEnhancedEcommerceProductContext:".concat(e),o.id,o.name,o.list,o.brand,o.category,o.variant,o.price,o.quantity,o.coupon,o.position,o.currency);break;case"enhancedecommercepromocontext":snowplow("addEnhancedEcommercePromoContext:".concat(e),o.id,o.name,o.creative,o.position,o.currency);break;case"enhancedecommerceaction":snowplow("trackEnhancedEcommerceAction:".concat(e),o.action);break;case"timing":snowplow("trackTiming:".concat(e),o.category,o.variable,o.timing,o.label,o.contexts);case"structevent":default:snowplow("trackStructEvent:".concat(e),o.category||"All",n||o.action,o.label,o.property,o.value,o.contexts)}}return function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=o(o({},t),e);return{name:n.name,initialize:function(){var e,o,t,c,a,r,i,s=n.scriptSrc,l=n.collectorUrl,w=n.name,p=n.trackerSettings;if(!s)throw new Error("No Snowplow sp.js location defined");if(!l)throw new Error("No collector url defined");e=window,o=document,t="script",c=s,e[a="snowplow"]||(e.GlobalSnowplowNamespace=e.GlobalSnowplowNamespace||[],e.GlobalSnowplowNamespace.push(a),e[a]=function(){(e[a].q=e[a].q||[]).push(arguments)},e[a].q=e[a].q||[],r=o.createElement(t),i=o.getElementsByTagName(t)[0],r.async=1,r.src=c,i.parentNode.insertBefore(r,i)),snowplow("newTracker",w,l,p)},page:function(e){var o=e.payload.properties,t=n.name;c()||(snowplow("setCustomUrl:".concat(t),o.url),snowplow("setReferrerUrl:".concat(t),o.referrer),snowplow("trackPageView:".concat(t),o.title,o.contexts,o.dynamicContexts))},reset:function(){var e=n.name;c()||(snowplow("clearUserData:".concat(e)),snowplow("setUserId:".concat(e),void 0),snowplow("clearGlobalContexts:".concat(e)))},track:function(e){var o=e.payload,t=o.event,r=o.properties,i=n.name;c()||a(i,t,r)},identify:function(e){var o=e.payload.userId,t=n.name;c()||o&&snowplow("setUserId:".concat(t),o)},loaded:function(){return!c()},methods:{enableActivityTracking:function(e,o){var t=n.name;snowplow("enableActivityTracking:".concat(t),e,o)},refreshLinkClickTracking:function(){var e=n.name;snowplow("refreshLinkClickTracking:".concat(e))},enableFormTracking:function(e,o){var t=n.name;snowplow("enableFormTracking:".concat(t),e||{},o||null)},enableGdprContext:function(e,o,t,c){var a=n.name;snowplow("enableGdprContext:".concat(a),e,o||null,t||null,c||null)},enableLinkClickTracking:function(e,o,t,c){var a=n.name;snowplow("enableLinkClickTracking:".concat(a),e||{},o||!0,t||!1,c||null)},enableErrorTracking:function(e,o){var t=n.name;snowplow("enableErrorTracking:".concat(t),e||null,o||null)},addGlobalContexts:function(e){var o=n.name,t=e.contexts;e.filterConditions&&(t=[e.filterConditions,t]),snowplow("addGlobalContexts:".concat(o),t)},removeGlobalContexts:function(e){var o=n.name;snowplow("removeGlobalContexts:".concat(o),e)},clearGlobalContexts:function(){var e=n.name;snowplow("clearGlobalContexts:".concat(e))},disableAnonymousTracking:function(e){var o=n.name;snowplow("disableAnonymousTracking:".concat(o),e)},enableAnonymousTracking:function(e){var o=n.name;snowplow("enableAnonymousTracking:".concat(o),e)}}}}}(); | ||
var analyticsSnowplow=function(){"use strict";function e(e,n,o){return n in e?Object.defineProperty(e,n,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[n]=o,e}function n(e,n){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);n&&(t=t.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),o.push.apply(o,t)}return o}function o(o){for(var t=1;t<arguments.length;t++){var c=null!=arguments[t]?arguments[t]:{};t%2?n(c,!0).forEach(function(n){e(o,n,c[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(c)):n(c).forEach(function(e){Object.defineProperty(o,e,Object.getOwnPropertyDescriptor(c,e))})}return o}var t={name:"snowplow",trackerSettings:{contexts:{webPage:!0}}};function c(){return!window.snowplow}return function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=o(o({},t),e);return{name:n.name,initialize:function(){var e,o,t,c,a,r,i,s=n.scriptSrc,l=n.collectorUrl,w=n.name,p=n.trackerSettings;if(!s)throw new Error("No Snowplow sp.js location defined");if(!l)throw new Error("No collector url defined");e=window,o=document,t="script",c=s,e[a="snowplow"]||(e.GlobalSnowplowNamespace=e.GlobalSnowplowNamespace||[],e.GlobalSnowplowNamespace.push(a),e[a]=function(){(e[a].q=e[a].q||[]).push(arguments)},e[a].q=e[a].q||[],r=o.createElement(t),i=o.getElementsByTagName(t)[0],r.async=1,r.src=c,i.parentNode.insertBefore(r,i)),snowplow("newTracker",w,l,p)},page:function(e){var o=e.payload.properties,t=n.name;c()||(snowplow("setCustomUrl:".concat(t),o.url),snowplow("setReferrerUrl:".concat(t),o.referrer),snowplow("trackPageView:".concat(t),o.title,o.contexts,o.dynamicContexts))},reset:function(){var e=n.name;c()||(snowplow("clearUserData:".concat(e)),snowplow("setUserId:".concat(e),void 0),snowplow("clearGlobalContexts:".concat(e)))},track:function(e){var o=e.payload,t=o.event,a=o.properties,r=n.name;c()||function(e,n,o){if(n&&o)switch(n.toLowerCase()){case"selfdescribingevent":case"unstructevent":snowplow("trackSelfDescribingEvent:".concat(e),{schema:o.schema,data:o.data},o.contexts);break;case"socialinteraction":snowplow("trackSocialInteraction:".concat(e),o.action,o.network,o.target,o.contexts);break;case"adimpression":snowplow("trackAdImpression:".concat(e),o.impressionId,o.costModel,o.cost,o.targetUrl,o.bannerId,o.zoneId,o.advertiserId,o.campaignId,o.contexts);break;case"adclick":snowplow("trackAdClick:".concat(e),o.targetUrl,o.clickId,o.costModel,o.cost,o.bannerId,o.zoneId,o.impressionId,o.advertiserId,o.campaignId,o.contexts);break;case"adconversion":snowplow("trackAdConversion:".concat(e),o.conversionId,o.costModel,o.cost,o.category,o.action,o.property,o.initialValue,o.advertiserId,o.campaignId,o.contexts);break;case"linkclick":snowplow("trackLinkClick:".concat(e),o.targetUrl,o.elementId,o.elementClasses,o.elementTarget,o.elementContent,o.contexts);break;case"addtocart":snowplow("trackAddToCart:".concat(e),o.sku,o.name,o.category,o.unitPrice,o.quantity,o.currency,o.contexts);break;case"removefromcart":snowplow("trackRemoveFromCart:".concat(e),o.sku,o.name,o.category,o.unitPrice,o.quantity,o.currency,o.contexts);break;case"sitesearch":snowplow("trackSiteSearch:".concat(e),o.searchTerms,o.filters,o.resultsFound,o.resultsDisplayed,o.contexts);break;case"consentgranted":snowplow("trackConsentGranted:".concat(e),o.id,o.version,o.name,o.description,o.expiry,o.contexts);break;case"consentwithdrawn":snowplow("trackConsentWithdrawn:".concat(e),o.all,o.id,o.version,o.name,o.description,o.contexts);break;case"error":snowplow("trackError:".concat(e),o.message,o.filename,o.lineno,o.colno,o.error,o.contexts);break;case"enhancedecommerceactioncontext":snowplow("addEnhancedEcommerceActionContext:".concat(e),o.id,o.affiliation,o.revenue,o.tax,o.shipping,o.coupon,o.list,o.step,o.option,o.currency);break;case"enhancedecommerceimpressioncontext":snowplow("addEnhancedEcommerceImpressionContext:".concat(e),o.id,o.name,o.list,o.brand,o.category,o.variant,o.position,o.price,o.currency);break;case"enhancedecommerceproductcontext":snowplow("addEnhancedEcommerceProductContext:".concat(e),o.id,o.name,o.list,o.brand,o.category,o.variant,o.price,o.quantity,o.coupon,o.position,o.currency);break;case"enhancedecommercepromocontext":snowplow("addEnhancedEcommercePromoContext:".concat(e),o.id,o.name,o.creative,o.position,o.currency);break;case"enhancedecommerceaction":snowplow("trackEnhancedEcommerceAction:".concat(e),o.action);break;case"timing":snowplow("trackTiming:".concat(e),o.category,o.variable,o.timing,o.label,o.contexts);case"structevent":default:snowplow("trackStructEvent:".concat(e),o.category||"All",n||o.action,o.label,o.property,o.value,o.contexts)}}(r,t,a)},identify:function(e){var o=e.payload.userId,t=n.name;c()||o&&snowplow("setUserId:".concat(t),o)},loaded:function(){return!c()},methods:{enableActivityTracking:function(e,o){var t=n.name;snowplow("enableActivityTracking:".concat(t),e,o)},refreshLinkClickTracking:function(){var e=n.name;snowplow("refreshLinkClickTracking:".concat(e))},enableFormTracking:function(e,o){var t=n.name;snowplow("enableFormTracking:".concat(t),e||{},o||null)},enableGdprContext:function(e,o,t,c){var a=n.name;snowplow("enableGdprContext:".concat(a),e,o||null,t||null,c||null)},enableLinkClickTracking:function(e,o,t,c){var a=n.name;snowplow("enableLinkClickTracking:".concat(a),e||{},o||!0,t||!1,c||null)},enableErrorTracking:function(e,o){var t=n.name;snowplow("enableErrorTracking:".concat(t),e||null,o||null)},addGlobalContexts:function(e){var o=n.name,t=e.contexts;e.filterConditions&&(t=[e.filterConditions,t]),snowplow("addGlobalContexts:".concat(o),t)},removeGlobalContexts:function(e){var o=n.name;snowplow("removeGlobalContexts:".concat(o),e)},clearGlobalContexts:function(){var e=n.name;snowplow("clearGlobalContexts:".concat(e))},disableAnonymousTracking:function(e){var o=n.name;snowplow("disableAnonymousTracking:".concat(o),e)},enableAnonymousTracking:function(e){var o=n.name;snowplow("enableAnonymousTracking:".concat(o),e)}}}}}(); |
@@ -37,3 +37,3 @@ 'use strict'; | ||
if (i % 2) { | ||
ownKeys(Object(source), true).forEach(function (key) { | ||
ownKeys(source, true).forEach(function (key) { | ||
_defineProperty(target, key, source[key]); | ||
@@ -44,3 +44,3 @@ }); | ||
} else { | ||
ownKeys(Object(source)).forEach(function (key) { | ||
ownKeys(source).forEach(function (key) { | ||
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); | ||
@@ -63,63 +63,64 @@ }); | ||
} | ||
/** | ||
* Snowplow analytics integration | ||
* @link https://getanalytics.io/plugins/snowplow/ | ||
* @link https://docs.snowplowanalytics.com/docs/collecting-data/collecting-from-own-applications/javascript-tracker/ | ||
* @param {Object} pluginConfig - Plugin settings | ||
* @param {string} pluginConfig.scriptSrc - Self-hosted Snowplow sp.js file location | ||
* @param {string} pluginConfig.collectorUrl - The URL to a Snowplow collector | ||
* @param {string} [pluginConfig.name] - The name to identify this instance of the tracker, use if using multiple tracker instances ('snowplow' default) | ||
* @param {Object} [pluginConfig.trackerSettings] - The arg map to pass to the Snowplow Tracker | ||
* @param {string} [pluginConfig.trackerSettings.appId] - The appId to identify this application | ||
* @param {string} [pluginConfig.trackerSettings.platform] - Platform of tracking ("web" default) | ||
* @param {string} [pluginConfig.trackerSettings.cookieDomain] - Domain to set cookie against | ||
* @param {string} [pluginConfig.trackerSettings.discoverRootDomain] - Automatically discover root domain | ||
* @param {string} [pluginConfig.trackerSettings.cookieName] - Prefix for cookies ("_sp_" default) | ||
* @param {string} [pluginConfig.trackerSettings.cookieSameSite] - SameSite cookie setting ("None" default) | ||
* @param {boolean} [pluginConfig.trackerSettings.cookieSecure] - Secure cookie setting (true default) | ||
* @param {boolean} [pluginConfig.trackerSettings.encodeBase64] - Encode JSON objects as Base64 (true default) | ||
* @param {bolean} [pluginConfig.trackerSettings.respectDoNotTrack] - Respect do not track (consider analytics-plugin-do-not-track) (false default) | ||
* @param {number} [pluginConfig.trackerSettings.pageUnloadTimer] - Timeout in ms to block page navigation until buffer is empty (500 default) | ||
* @param {boolean} [pluginConfig.trackerSettings.forceSecureTracker] - Forces requests to be sent https (false default) | ||
* @param {string} [pluginConfig.trackerSettings.eventMethod] - Method to send events, GET, POST, Beacon (POST default) | ||
* @param {number} [pluginConfig.trackerSettings.bufferSize] - Amount of events to buffer before sending (1 default) | ||
* @param {number} [pluginConfig.trackerSettings.maxPostBytes] - Maximum size of POST or Beacon before sending (40000 default) | ||
* @param {string} [pluginConfig.trackerSettings.crossDomainLinker] - function to configure which links to add cross domain linking | ||
* @param {number} [pluginConfig.trackerSettings.cookieLifetime] - Cookie lifetime (63072000 default) | ||
* @param {string} [pluginConfig.trackerSettings.stateStorageStrategy] - Use cookies and/or localstorage ("cookieAndLocalStorage" default) | ||
* @param {number} [pluginConfig.trackerSettings.maxLocalStorageQueueSize] - Maximum numbers of events to buffer in localstorage to prevent filling local storage (1000 default) | ||
* @param {boolean} [pluginConfig.trackerSettings.resetActivityTrackingOnPageView] - Flag to decide whether to reset page ping timers on virtual page view (true default) | ||
* @param {boolean} [pluginConfig.trackerSettings.connectionTimeout] - The timeout, in milliseconds, before GET and POST requests will timeout (5000 default) (Snowplow JS 2.15.0+) | ||
* @param {string[]} [pluginConfig.trackerSettings.skippedBrowserFeatures] - Array to skip browser feature collection ([] default) (Snowplow JS 2.15.0+) | ||
* @param {(Object|boolean)} [pluginConfig.trackerSettings.anonymousTracking] - Flag to enable anonymous tracking functionality (false default) | ||
* @param {boolean} [pluginConfig.trackerSettings.anonymousTracking.withSessionTracking] - Flag to enable whether to continue tracking sessions in anonymous tracking mode (false default) | ||
* @param {boolean} [pluginConfig.trackerSettings.anonymousTracking.withServerAnonymisation] - Flag which prevents collector from returning and capturing cookies and capturing ip address (false default) | ||
* @param {Object} [pluginConfig.trackerSettings.contexts] - The auto contexts for each event | ||
* @param {boolean} [pluginConfig.trackerSettings.contexts.webPage] - The webpage context, containing the page view id. (true default) | ||
* @param {boolean} [pluginConfig.trackerSettings.contexts.performanceTiming] - Add performance timing information | ||
* @param {(Object|boolean)} [pluginConfig.trackerSettings.contexts.clientHints] - Add Client Hint information (Snowplow JS 2.15.0+) | ||
* @param {boolean} [pluginConfig.trackerSettings.contexts.clientHints.includeHighEntropy] - Capture High Entropy Client Hints (Snowplow JS 2.15.0+) | ||
* @param {boolean} [pluginConfig.trackerSettings.contexts.gaCookies] - Add gaCookie information | ||
* @param {boolean} [pluginConfig.trackerSettings.contexts.geolocation] - Add browser geolocation information | ||
* @param {boolean} [pluginConfig.trackerSettings.contexts.optimizelyXSummary] - Add browser geolocation information | ||
* @return {Object} Analytics plugin | ||
* | ||
* @example | ||
* | ||
* // Minimal recommended configuration | ||
* snowplowPlugin({ | ||
* name: 'snowplow', | ||
* scriptSrc: '//*.cloudfront.net/2.17.0/sp.js', | ||
* collectorUrl: 'collector.mysite.com', | ||
* trackerSettings: { | ||
* appId: 'myApp', | ||
* contexts: { | ||
* webPage: true | ||
* } | ||
* } | ||
* }) | ||
*/ | ||
}; | ||
/** | ||
* Snowplow analytics integration | ||
* @link https://getanalytics.io/plugins/snowplow/ | ||
* @link https://docs.snowplowanalytics.com/docs/collecting-data/collecting-from-own-applications/javascript-tracker/ | ||
* @param {Object} pluginConfig - Plugin settings | ||
* @param {string} pluginConfig.scriptSrc - Self-hosted Snowplow sp.js file location | ||
* @param {string} pluginConfig.collectorUrl - The URL to a Snowplow collector | ||
* @param {string} [pluginConfig.name] - The name to identify this instance of the tracker, use if using multiple tracker instances ('snowplow' default) | ||
* @param {Object} [pluginConfig.trackerSettings] - The arg map to pass to the Snowplow Tracker | ||
* @param {string} [pluginConfig.trackerSettings.appId] - The appId to identify this application | ||
* @param {string} [pluginConfig.trackerSettings.platform] - Platform of tracking ("web" default) | ||
* @param {string} [pluginConfig.trackerSettings.cookieDomain] - Domain to set cookie against | ||
* @param {string} [pluginConfig.trackerSettings.discoverRootDomain] - Automatically discover root domain | ||
* @param {string} [pluginConfig.trackerSettings.cookieName] - Prefix for cookies ("_sp_" default) | ||
* @param {string} [pluginConfig.trackerSettings.cookieSameSite] - SameSite cookie setting ("None" default) | ||
* @param {boolean} [pluginConfig.trackerSettings.cookieSecure] - Secure cookie setting (true default) | ||
* @param {boolean} [pluginConfig.trackerSettings.encodeBase64] - Encode JSON objects as Base64 (true default) | ||
* @param {bolean} [pluginConfig.trackerSettings.respectDoNotTrack] - Respect do not track (consider analytics-plugin-do-not-track) (false default) | ||
* @param {number} [pluginConfig.trackerSettings.pageUnloadTimer] - Timeout in ms to block page navigation until buffer is empty (500 default) | ||
* @param {boolean} [pluginConfig.trackerSettings.forceSecureTracker] - Forces requests to be sent https (false default) | ||
* @param {string} [pluginConfig.trackerSettings.eventMethod] - Method to send events, GET, POST, Beacon (POST default) | ||
* @param {number} [pluginConfig.trackerSettings.bufferSize] - Amount of events to buffer before sending (1 default) | ||
* @param {number} [pluginConfig.trackerSettings.maxPostBytes] - Maximum size of POST or Beacon before sending (40000 default) | ||
* @param {string} [pluginConfig.trackerSettings.crossDomainLinker] - function to configure which links to add cross domain linking | ||
* @param {number} [pluginConfig.trackerSettings.cookieLifetime] - Cookie lifetime (63072000 default) | ||
* @param {string} [pluginConfig.trackerSettings.stateStorageStrategy] - Use cookies and/or localstorage ("cookieAndLocalStorage" default) | ||
* @param {number} [pluginConfig.trackerSettings.maxLocalStorageQueueSize] - Maximum numbers of events to buffer in localstorage to prevent filling local storage (1000 default) | ||
* @param {boolean} [pluginConfig.trackerSettings.resetActivityTrackingOnPageView] - Flag to decide whether to reset page ping timers on virtual page view (true default) | ||
* @param {boolean} [pluginConfig.trackerSettings.connectionTimeout] - The timeout, in milliseconds, before GET and POST requests will timeout (5000 default) (Snowplow JS 2.15.0+) | ||
* @param {string[]} [pluginConfig.trackerSettings.skippedBrowserFeatures] - Array to skip browser feature collection ([] default) (Snowplow JS 2.15.0+) | ||
* @param {(Object|boolean)} [pluginConfig.trackerSettings.anonymousTracking] - Flag to enable anonymous tracking functionality (false default) | ||
* @param {boolean} [pluginConfig.trackerSettings.anonymousTracking.withSessionTracking] - Flag to enable whether to continue tracking sessions in anonymous tracking mode (false default) | ||
* @param {boolean} [pluginConfig.trackerSettings.anonymousTracking.withServerAnonymisation] - Flag which prevents collector from returning and capturing cookies and capturing ip address (false default) | ||
* @param {Object} [pluginConfig.trackerSettings.contexts] - The auto contexts for each event | ||
* @param {boolean} [pluginConfig.trackerSettings.contexts.webPage] - The webpage context, containing the page view id. (true default) | ||
* @param {boolean} [pluginConfig.trackerSettings.contexts.performanceTiming] - Add performance timing information | ||
* @param {(Object|boolean)} [pluginConfig.trackerSettings.contexts.clientHints] - Add Client Hint information (Snowplow JS 2.15.0+) | ||
* @param {boolean} [pluginConfig.trackerSettings.contexts.clientHints.includeHighEntropy] - Capture High Entropy Client Hints (Snowplow JS 2.15.0+) | ||
* @param {boolean} [pluginConfig.trackerSettings.contexts.gaCookies] - Add gaCookie information | ||
* @param {boolean} [pluginConfig.trackerSettings.contexts.geolocation] - Add browser geolocation information | ||
* @param {boolean} [pluginConfig.trackerSettings.contexts.optimizelyXSummary] - Add browser geolocation information | ||
* @return {Object} Analytics plugin | ||
* | ||
* @example | ||
* | ||
* // Minimal recommended configuration | ||
* snowplowPlugin({ | ||
* name: 'snowplow', | ||
* scriptSrc: '//*.cloudfront.net/2.17.0/sp.js', | ||
* collectorUrl: 'collector.mysite.com', | ||
* trackerSettings: { | ||
* appId: 'myApp', | ||
* contexts: { | ||
* webPage: true | ||
* } | ||
* } | ||
* }) | ||
*/ | ||
function snowplowPlugin() { | ||
function snowplowPlugin$1() { | ||
var pluginConfig = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
@@ -467,4 +468,4 @@ | ||
case 'adconversion': | ||
snowplow("trackAdConversion:".concat(name), properties.conversionId, properties.cost, properties.category, properties.action, properties.property, properties.initialValue, // how much the conversion is initially worth | ||
properties.advertiserId, properties.costModel, properties.campaignId, properties.contexts); | ||
snowplow("trackAdConversion:".concat(name), properties.conversionId, properties.costModel, properties.cost, properties.category, properties.action, properties.property, properties.initialValue, // how much the conversion is initially worth | ||
properties.advertiserId, properties.campaignId, properties.contexts); | ||
break; | ||
@@ -481,3 +482,3 @@ | ||
case 'removefromcart': | ||
snowplow("trackRemoveToCart:".concat(name), properties.sku, properties.name, properties.category, properties.unitPrice, properties.quantity, properties.currency, properties.contexts); | ||
snowplow("trackRemoveFromCart:".concat(name), properties.sku, properties.name, properties.category, properties.unitPrice, properties.quantity, properties.currency, properties.contexts); | ||
break; | ||
@@ -593,4 +594,4 @@ | ||
var index = snowplowPlugin ; | ||
var index = snowplowPlugin$1; | ||
module.exports = index; |
@@ -35,3 +35,3 @@ function _defineProperty(obj, key, value) { | ||
if (i % 2) { | ||
ownKeys(Object(source), true).forEach(function (key) { | ||
ownKeys(source, true).forEach(function (key) { | ||
_defineProperty(target, key, source[key]); | ||
@@ -42,3 +42,3 @@ }); | ||
} else { | ||
ownKeys(Object(source)).forEach(function (key) { | ||
ownKeys(source).forEach(function (key) { | ||
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); | ||
@@ -61,63 +61,64 @@ }); | ||
} | ||
/** | ||
* Snowplow analytics integration | ||
* @link https://getanalytics.io/plugins/snowplow/ | ||
* @link https://docs.snowplowanalytics.com/docs/collecting-data/collecting-from-own-applications/javascript-tracker/ | ||
* @param {Object} pluginConfig - Plugin settings | ||
* @param {string} pluginConfig.scriptSrc - Self-hosted Snowplow sp.js file location | ||
* @param {string} pluginConfig.collectorUrl - The URL to a Snowplow collector | ||
* @param {string} [pluginConfig.name] - The name to identify this instance of the tracker, use if using multiple tracker instances ('snowplow' default) | ||
* @param {Object} [pluginConfig.trackerSettings] - The arg map to pass to the Snowplow Tracker | ||
* @param {string} [pluginConfig.trackerSettings.appId] - The appId to identify this application | ||
* @param {string} [pluginConfig.trackerSettings.platform] - Platform of tracking ("web" default) | ||
* @param {string} [pluginConfig.trackerSettings.cookieDomain] - Domain to set cookie against | ||
* @param {string} [pluginConfig.trackerSettings.discoverRootDomain] - Automatically discover root domain | ||
* @param {string} [pluginConfig.trackerSettings.cookieName] - Prefix for cookies ("_sp_" default) | ||
* @param {string} [pluginConfig.trackerSettings.cookieSameSite] - SameSite cookie setting ("None" default) | ||
* @param {boolean} [pluginConfig.trackerSettings.cookieSecure] - Secure cookie setting (true default) | ||
* @param {boolean} [pluginConfig.trackerSettings.encodeBase64] - Encode JSON objects as Base64 (true default) | ||
* @param {bolean} [pluginConfig.trackerSettings.respectDoNotTrack] - Respect do not track (consider analytics-plugin-do-not-track) (false default) | ||
* @param {number} [pluginConfig.trackerSettings.pageUnloadTimer] - Timeout in ms to block page navigation until buffer is empty (500 default) | ||
* @param {boolean} [pluginConfig.trackerSettings.forceSecureTracker] - Forces requests to be sent https (false default) | ||
* @param {string} [pluginConfig.trackerSettings.eventMethod] - Method to send events, GET, POST, Beacon (POST default) | ||
* @param {number} [pluginConfig.trackerSettings.bufferSize] - Amount of events to buffer before sending (1 default) | ||
* @param {number} [pluginConfig.trackerSettings.maxPostBytes] - Maximum size of POST or Beacon before sending (40000 default) | ||
* @param {string} [pluginConfig.trackerSettings.crossDomainLinker] - function to configure which links to add cross domain linking | ||
* @param {number} [pluginConfig.trackerSettings.cookieLifetime] - Cookie lifetime (63072000 default) | ||
* @param {string} [pluginConfig.trackerSettings.stateStorageStrategy] - Use cookies and/or localstorage ("cookieAndLocalStorage" default) | ||
* @param {number} [pluginConfig.trackerSettings.maxLocalStorageQueueSize] - Maximum numbers of events to buffer in localstorage to prevent filling local storage (1000 default) | ||
* @param {boolean} [pluginConfig.trackerSettings.resetActivityTrackingOnPageView] - Flag to decide whether to reset page ping timers on virtual page view (true default) | ||
* @param {boolean} [pluginConfig.trackerSettings.connectionTimeout] - The timeout, in milliseconds, before GET and POST requests will timeout (5000 default) (Snowplow JS 2.15.0+) | ||
* @param {string[]} [pluginConfig.trackerSettings.skippedBrowserFeatures] - Array to skip browser feature collection ([] default) (Snowplow JS 2.15.0+) | ||
* @param {(Object|boolean)} [pluginConfig.trackerSettings.anonymousTracking] - Flag to enable anonymous tracking functionality (false default) | ||
* @param {boolean} [pluginConfig.trackerSettings.anonymousTracking.withSessionTracking] - Flag to enable whether to continue tracking sessions in anonymous tracking mode (false default) | ||
* @param {boolean} [pluginConfig.trackerSettings.anonymousTracking.withServerAnonymisation] - Flag which prevents collector from returning and capturing cookies and capturing ip address (false default) | ||
* @param {Object} [pluginConfig.trackerSettings.contexts] - The auto contexts for each event | ||
* @param {boolean} [pluginConfig.trackerSettings.contexts.webPage] - The webpage context, containing the page view id. (true default) | ||
* @param {boolean} [pluginConfig.trackerSettings.contexts.performanceTiming] - Add performance timing information | ||
* @param {(Object|boolean)} [pluginConfig.trackerSettings.contexts.clientHints] - Add Client Hint information (Snowplow JS 2.15.0+) | ||
* @param {boolean} [pluginConfig.trackerSettings.contexts.clientHints.includeHighEntropy] - Capture High Entropy Client Hints (Snowplow JS 2.15.0+) | ||
* @param {boolean} [pluginConfig.trackerSettings.contexts.gaCookies] - Add gaCookie information | ||
* @param {boolean} [pluginConfig.trackerSettings.contexts.geolocation] - Add browser geolocation information | ||
* @param {boolean} [pluginConfig.trackerSettings.contexts.optimizelyXSummary] - Add browser geolocation information | ||
* @return {Object} Analytics plugin | ||
* | ||
* @example | ||
* | ||
* // Minimal recommended configuration | ||
* snowplowPlugin({ | ||
* name: 'snowplow', | ||
* scriptSrc: '//*.cloudfront.net/2.17.0/sp.js', | ||
* collectorUrl: 'collector.mysite.com', | ||
* trackerSettings: { | ||
* appId: 'myApp', | ||
* contexts: { | ||
* webPage: true | ||
* } | ||
* } | ||
* }) | ||
*/ | ||
}; | ||
/** | ||
* Snowplow analytics integration | ||
* @link https://getanalytics.io/plugins/snowplow/ | ||
* @link https://docs.snowplowanalytics.com/docs/collecting-data/collecting-from-own-applications/javascript-tracker/ | ||
* @param {Object} pluginConfig - Plugin settings | ||
* @param {string} pluginConfig.scriptSrc - Self-hosted Snowplow sp.js file location | ||
* @param {string} pluginConfig.collectorUrl - The URL to a Snowplow collector | ||
* @param {string} [pluginConfig.name] - The name to identify this instance of the tracker, use if using multiple tracker instances ('snowplow' default) | ||
* @param {Object} [pluginConfig.trackerSettings] - The arg map to pass to the Snowplow Tracker | ||
* @param {string} [pluginConfig.trackerSettings.appId] - The appId to identify this application | ||
* @param {string} [pluginConfig.trackerSettings.platform] - Platform of tracking ("web" default) | ||
* @param {string} [pluginConfig.trackerSettings.cookieDomain] - Domain to set cookie against | ||
* @param {string} [pluginConfig.trackerSettings.discoverRootDomain] - Automatically discover root domain | ||
* @param {string} [pluginConfig.trackerSettings.cookieName] - Prefix for cookies ("_sp_" default) | ||
* @param {string} [pluginConfig.trackerSettings.cookieSameSite] - SameSite cookie setting ("None" default) | ||
* @param {boolean} [pluginConfig.trackerSettings.cookieSecure] - Secure cookie setting (true default) | ||
* @param {boolean} [pluginConfig.trackerSettings.encodeBase64] - Encode JSON objects as Base64 (true default) | ||
* @param {bolean} [pluginConfig.trackerSettings.respectDoNotTrack] - Respect do not track (consider analytics-plugin-do-not-track) (false default) | ||
* @param {number} [pluginConfig.trackerSettings.pageUnloadTimer] - Timeout in ms to block page navigation until buffer is empty (500 default) | ||
* @param {boolean} [pluginConfig.trackerSettings.forceSecureTracker] - Forces requests to be sent https (false default) | ||
* @param {string} [pluginConfig.trackerSettings.eventMethod] - Method to send events, GET, POST, Beacon (POST default) | ||
* @param {number} [pluginConfig.trackerSettings.bufferSize] - Amount of events to buffer before sending (1 default) | ||
* @param {number} [pluginConfig.trackerSettings.maxPostBytes] - Maximum size of POST or Beacon before sending (40000 default) | ||
* @param {string} [pluginConfig.trackerSettings.crossDomainLinker] - function to configure which links to add cross domain linking | ||
* @param {number} [pluginConfig.trackerSettings.cookieLifetime] - Cookie lifetime (63072000 default) | ||
* @param {string} [pluginConfig.trackerSettings.stateStorageStrategy] - Use cookies and/or localstorage ("cookieAndLocalStorage" default) | ||
* @param {number} [pluginConfig.trackerSettings.maxLocalStorageQueueSize] - Maximum numbers of events to buffer in localstorage to prevent filling local storage (1000 default) | ||
* @param {boolean} [pluginConfig.trackerSettings.resetActivityTrackingOnPageView] - Flag to decide whether to reset page ping timers on virtual page view (true default) | ||
* @param {boolean} [pluginConfig.trackerSettings.connectionTimeout] - The timeout, in milliseconds, before GET and POST requests will timeout (5000 default) (Snowplow JS 2.15.0+) | ||
* @param {string[]} [pluginConfig.trackerSettings.skippedBrowserFeatures] - Array to skip browser feature collection ([] default) (Snowplow JS 2.15.0+) | ||
* @param {(Object|boolean)} [pluginConfig.trackerSettings.anonymousTracking] - Flag to enable anonymous tracking functionality (false default) | ||
* @param {boolean} [pluginConfig.trackerSettings.anonymousTracking.withSessionTracking] - Flag to enable whether to continue tracking sessions in anonymous tracking mode (false default) | ||
* @param {boolean} [pluginConfig.trackerSettings.anonymousTracking.withServerAnonymisation] - Flag which prevents collector from returning and capturing cookies and capturing ip address (false default) | ||
* @param {Object} [pluginConfig.trackerSettings.contexts] - The auto contexts for each event | ||
* @param {boolean} [pluginConfig.trackerSettings.contexts.webPage] - The webpage context, containing the page view id. (true default) | ||
* @param {boolean} [pluginConfig.trackerSettings.contexts.performanceTiming] - Add performance timing information | ||
* @param {(Object|boolean)} [pluginConfig.trackerSettings.contexts.clientHints] - Add Client Hint information (Snowplow JS 2.15.0+) | ||
* @param {boolean} [pluginConfig.trackerSettings.contexts.clientHints.includeHighEntropy] - Capture High Entropy Client Hints (Snowplow JS 2.15.0+) | ||
* @param {boolean} [pluginConfig.trackerSettings.contexts.gaCookies] - Add gaCookie information | ||
* @param {boolean} [pluginConfig.trackerSettings.contexts.geolocation] - Add browser geolocation information | ||
* @param {boolean} [pluginConfig.trackerSettings.contexts.optimizelyXSummary] - Add browser geolocation information | ||
* @return {Object} Analytics plugin | ||
* | ||
* @example | ||
* | ||
* // Minimal recommended configuration | ||
* snowplowPlugin({ | ||
* name: 'snowplow', | ||
* scriptSrc: '//*.cloudfront.net/2.17.0/sp.js', | ||
* collectorUrl: 'collector.mysite.com', | ||
* trackerSettings: { | ||
* appId: 'myApp', | ||
* contexts: { | ||
* webPage: true | ||
* } | ||
* } | ||
* }) | ||
*/ | ||
function snowplowPlugin() { | ||
function snowplowPlugin$1() { | ||
var pluginConfig = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
@@ -465,4 +466,4 @@ | ||
case 'adconversion': | ||
snowplow("trackAdConversion:".concat(name), properties.conversionId, properties.cost, properties.category, properties.action, properties.property, properties.initialValue, // how much the conversion is initially worth | ||
properties.advertiserId, properties.costModel, properties.campaignId, properties.contexts); | ||
snowplow("trackAdConversion:".concat(name), properties.conversionId, properties.costModel, properties.cost, properties.category, properties.action, properties.property, properties.initialValue, // how much the conversion is initially worth | ||
properties.advertiserId, properties.campaignId, properties.contexts); | ||
break; | ||
@@ -479,3 +480,3 @@ | ||
case 'removefromcart': | ||
snowplow("trackRemoveToCart:".concat(name), properties.sku, properties.name, properties.category, properties.unitPrice, properties.quantity, properties.currency, properties.contexts); | ||
snowplow("trackRemoveFromCart:".concat(name), properties.sku, properties.name, properties.category, properties.unitPrice, properties.quantity, properties.currency, properties.contexts); | ||
break; | ||
@@ -591,4 +592,4 @@ | ||
var index = snowplowPlugin ; | ||
var index = snowplowPlugin$1; | ||
export default index; |
'use strict'; | ||
var snowplow, gotEmitter, tracker; | ||
var snowplow$1, gotEmitter, tracker; | ||
{ | ||
snowplow = require('snowplow-tracker'); | ||
gotEmitter = snowplow.gotEmitter; | ||
tracker = snowplow.tracker; | ||
snowplow$1 = require('snowplow-tracker'); | ||
gotEmitter = snowplow$1.gotEmitter; | ||
tracker = snowplow$1.tracker; | ||
} | ||
@@ -224,4 +224,66 @@ /** | ||
var index = snowplowPlugin; | ||
/** | ||
* @typedef {Object} Context | ||
* @property {string} schema - The Schema which describes the context | ||
* @property {Object} data - The data object which conforms to the schema | ||
*/ | ||
/** | ||
* A function which determines which links should be tracked | ||
* @callback linkClickFilter | ||
* @param {Object} element | ||
* @return {boolean} true if the element should be tracked | ||
*/ | ||
/** | ||
* A function which determines which ErrorEvents should be tracked | ||
* @callback errorFilter | ||
* @param {Object} errorEvent | ||
* @return {boolean} true if the error should be tracked | ||
*/ | ||
/** | ||
* A function which determines which ErrorEvents should be tracked | ||
* @callback errorContexts | ||
* @param {Object} errorEvent | ||
* @return {Context[]} Array of contexts to be included with the error tracking event | ||
*/ | ||
/** | ||
* A function which determines which fields should be tracked | ||
* @callback formFieldsFilter | ||
* @param {Object} formElement | ||
* @return {boolean} true if the form field should be tracked | ||
*/ | ||
/** | ||
* Transforms a form elements value | ||
* @callback formFieldsTransform | ||
* @param {Object} formElement | ||
* @return {string} The value to replace this form elements value with | ||
*/ | ||
/** | ||
* @typedef {Object} GlobalContexts | ||
* @property {Context[]} contexts - The contexts to add | ||
* @property {GlobalContextFilter|GlobalContextRuleset} [filterConditions] - The Schema which describes the context | ||
*/ | ||
/** | ||
* A function which determines which contexts should be sent | ||
* @callback GlobalContextFilter | ||
* @param {Object} event | ||
* @param {string} event.eventType This argument is a string taken from the event payload field, e. e.g. pv, pp, se | ||
* @param {string} event.eventSchema The schema of the event | ||
* @return {boolean} true if the context should be included with the event | ||
*/ | ||
/** | ||
* @typedef {Object} GlobalContextRuleset | ||
* @property {string[]} [accept] - A list of schemas to attach this context to | ||
* @property {string[]} [reject] - A list of schemas to not attach this context too | ||
*/ | ||
var index = snowplowPlugin; | ||
module.exports = index; |
@@ -1,7 +0,7 @@ | ||
var snowplow, gotEmitter, tracker; | ||
var snowplow$1, gotEmitter, tracker; | ||
{ | ||
snowplow = require('snowplow-tracker'); | ||
gotEmitter = snowplow.gotEmitter; | ||
tracker = snowplow.tracker; | ||
snowplow$1 = require('snowplow-tracker'); | ||
gotEmitter = snowplow$1.gotEmitter; | ||
tracker = snowplow$1.tracker; | ||
} | ||
@@ -222,4 +222,66 @@ /** | ||
var index = snowplowPlugin; | ||
/** | ||
* @typedef {Object} Context | ||
* @property {string} schema - The Schema which describes the context | ||
* @property {Object} data - The data object which conforms to the schema | ||
*/ | ||
/** | ||
* A function which determines which links should be tracked | ||
* @callback linkClickFilter | ||
* @param {Object} element | ||
* @return {boolean} true if the element should be tracked | ||
*/ | ||
/** | ||
* A function which determines which ErrorEvents should be tracked | ||
* @callback errorFilter | ||
* @param {Object} errorEvent | ||
* @return {boolean} true if the error should be tracked | ||
*/ | ||
/** | ||
* A function which determines which ErrorEvents should be tracked | ||
* @callback errorContexts | ||
* @param {Object} errorEvent | ||
* @return {Context[]} Array of contexts to be included with the error tracking event | ||
*/ | ||
/** | ||
* A function which determines which fields should be tracked | ||
* @callback formFieldsFilter | ||
* @param {Object} formElement | ||
* @return {boolean} true if the form field should be tracked | ||
*/ | ||
/** | ||
* Transforms a form elements value | ||
* @callback formFieldsTransform | ||
* @param {Object} formElement | ||
* @return {string} The value to replace this form elements value with | ||
*/ | ||
/** | ||
* @typedef {Object} GlobalContexts | ||
* @property {Context[]} contexts - The contexts to add | ||
* @property {GlobalContextFilter|GlobalContextRuleset} [filterConditions] - The Schema which describes the context | ||
*/ | ||
/** | ||
* A function which determines which contexts should be sent | ||
* @callback GlobalContextFilter | ||
* @param {Object} event | ||
* @param {string} event.eventType This argument is a string taken from the event payload field, e. e.g. pv, pp, se | ||
* @param {string} event.eventSchema The schema of the event | ||
* @return {boolean} true if the context should be included with the event | ||
*/ | ||
/** | ||
* @typedef {Object} GlobalContextRuleset | ||
* @property {string[]} [accept] - A list of schemas to attach this context to | ||
* @property {string[]} [reject] - A list of schemas to not attach this context too | ||
*/ | ||
var index = snowplowPlugin; | ||
export default index; |
{ | ||
"name": "@analytics/snowplow", | ||
"version": "0.2.3", | ||
"version": "0.2.4", | ||
"description": "Snowplow integration for 'analytics' module for browser & node", | ||
@@ -60,3 +60,3 @@ "projectMeta": { | ||
}, | ||
"gitHead": "bf040feee18d72d29df9f7a86504eb50c044e8c2" | ||
"gitHead": "911c2bea233ea3f9c3e6912e9ed716b0b3f6e208" | ||
} |
136897
2077