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

@piwikpro/vue-piwik-pro

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@piwikpro/vue-piwik-pro - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

dist/index.js.map

17

dist/index.d.ts

@@ -1,15 +0,2 @@

export * as PageViews from './services/pageViews/pageViews.service';
export * as eCommerce from './services/e-commerce/e-commerce.service';
export * from './interfaces';
export * as UserManagement from './services/user-management/userManagement.service';
export * as CustomEvent from './services/custom-events/customEvents.service';
export * as ContentTracking from './services/content-tracking/contentTracking.service';
export * as GoalConversions from './services/goal-conversions/goal-conversions.service';
export * as DownloadAndOutlink from './services/download-and-outlink/download-and-outlink.service';
export * as SiteSearch from './services/site-search/site-search.service';
export * as CustomDimensions from './services/custom-dimensions/customDimensions.service';
export * as CookieManagement from './services/cookie-management/cookieManagement.service';
declare const _default: {
initialize: (containerId: string, containerUrl: string, nonce?: string | undefined) => void;
};
export default _default;
export { default } from '@piwikpro/tracking-base-library';
export * from '@piwikpro/tracking-base-library';

@@ -1,469 +0,631 @@

function a(e, n, o) {
if (!e) {
function init(containerId, containerUrl, nonce) {
if (!containerId) {
console.error("Empty tracking code for Piwik Pro.");
return;
}
if (!n) {
if (!containerUrl) {
console.error("Empty tracking URL for Piwik Pro.");
return;
}
if (document || console.error("Was not possible to access Document interface. Make sure this module is running on a Browser w/ access do Document interface."), !document || typeof document.createElement != "function") {
console.error("Was not possible to access Document interface. Make sure this module is running on a Browser w/ access do Document interface.");
if (typeof window === "undefined") {
console.error("Was not possible to access window. Make sure this module is running in a browser");
return;
}
let r;
try {
r = document.createElement("script");
} catch {
console.error("Was not possible to access Document interface. Make sure this module is running on a Browser w/ access do Document interface.");
return;
const scriptEl = document.createElement("script");
scriptEl.id = "PiwikPROInitializer";
scriptEl.async = true;
if (nonce) {
scriptEl.nonce = nonce;
}
r.async = !0, o && r.setAttribute("nonce", o), r.text = `(function(window, document, dataLayerName, id) {
window[dataLayerName]=window[dataLayerName]||[],window[dataLayerName].push({start:(new Date).getTime(),event:"stg.start"});var scripts=document.getElementsByTagName('script')[0],tags=document.createElement('script');
function stgCreateCookie(a,b,c){var d="";if(c){var e=new Date;e.setTime(e.getTime()+24*c*60*60*1e3),d="; expires="+e.toUTCString();f="; SameSite=Strict"}document.cookie=a+"="+b+d+f+"; path=/"}
var isStgDebug=(window.location.href.match("stg_debug")||document.cookie.match("stg_debug"))&&!window.location.href.match("stg_disable_debug");stgCreateCookie("stg_debug",isStgDebug?1:"",isStgDebug?14:-1);
var qP=[];dataLayerName!=="dataLayer"&&qP.push("data_layer_name="+dataLayerName),isStgDebug&&qP.push("stg_debug");var qPString=qP.length>0?("?"+qP.join("&")):"";
tags.async=!0,tags.src="${n}/"+id+".js"+qPString,scripts.parentNode.insertBefore(tags,scripts);
!function(a,n,i){a[n]=a[n]||{};for(var c=0;c<i.length;c++)!function(i){a[n][i]=a[n][i]||{},a[n][i].api=a[n][i].api||function(){var a=[].slice.call(arguments,0);"string"==typeof a[0]&&window[dataLayerName].push({event:n+"."+i+":"+a[0],parameters:[].slice.call(arguments,1)})}}(i[c])}(window,"ppms",["tm","cm"]);
})(window, document, 'dataLayer', '${e}')`, document.getElementsByTagName("body")[0].appendChild(r);
scriptEl.text = getInitScript({ containerId, containerUrl });
const body = document.getElementsByTagName("body")[0];
body.appendChild(scriptEl);
}
const E = typeof process < "u" && process.env.NODE_ENV === "development" || typeof window < "u" && window.IS_DEBUG || !1, _ = {
init: a
};
var i;
(function(e) {
e.PAGE_VIEW = "trackPageView", e.CUSTOM_EVENT = "trackEvent", e.GOAL = "trackGoal", e.SEARCH = "trackSiteSearch", e.ECOMMERCE_ADD_TO_CART = "ecommerceAddToCart", e.ADD_ECOMMERCE_ITEM = "addEcommerceItem", e.REMOVE_ECOMMERCE_ITEM = "removeEcommerceItem", e.ECOMMERCE_REMOVE_FROM_CART = "ecommerceRemoveFromCart", e.ECOMMERCE_PRODUCT_DETAIL_VIEW = "ecommerceProductDetailView", e.ECOMMERCE_CART_UPDATE = "ecommerceCartUpdate", e.TRACK_ECOMMERCE_CART_UPDATE = "trackEcommerceCartUpdate", e.TRACK_ECOMMERCE_ORDER = "trackEcommerceOrder", e.ECOMMERCE_ORDER = "ecommerceOrder", e.SET_ECOMMERCE_VIEW = "setEcommerceView", e.CLEAR_ECOMMERCE_CART = "clearEcommerceCart", e.SET_CUSTOM_VARIABLE = "setCustomVariable", e.DELETE_CUSTOM_VARIABLE = "deleteCustomVariable", e.STORE_CUSTOM_VARIABLES_IN_COOKIE = "storeCustomVariablesInCookie", e.SET_CUSTOM_DIMENSION_VALUE = "setCustomDimensionValue", e.DELETE_CUSTOM_DIMENSION = "deleteCustomDimension", e.SET_CUSTOM_DIMENSION = "setCustomDimension", e.ALL_CONTENT_IMPRESSIONS = "trackAllContentImpressions", e.VISIBLE_CONTENT_IMPRESSIONS = "trackVisibleContentImpressions", e.CONTENT_IMPRESSIONS_WITH_NODE = "trackContentImpressionsWithinNode", e.CONTENT_IMPRESSION = "trackContentImpression", e.LOG_ALL_CONTENT_BLOCKS_ON_PAGE = "logAllContentBlocksOnPage", e.CONTENT_INTERACTION_NODE = "trackContentInteractionNode", e.CONTENT_INTERACTION = "trackContentInteraction", e.LINK = "trackLink", e.ENABLE_LINK_TRACKING = "enableLinkTracking", e.SET_IGNORE_CLASSES = "setIgnoreClasses", e.SET_LINK_CLASSES = "setLinkClasses", e.SET_DOWNLOAD_CLASSES = "setDownloadClasses", e.SET_DOWNLOAD_EXTENSIONS = "setDownloadExtensions", e.ADD_DOWNLOAD_EXTENSIONS = "addDownloadExtensions", e.REMOVE_DOWNLOAD_EXTENSIONS = "removeDownloadExtensions", e.SET_LINK_TRACKING_TIMER = "setLinkTrackingTimer", e.SET_USER_ID = "setUserId", e.RESET_USER_ID = "resetUserId", e.SET_USER_IS_ANONYMOUS = "setUserIsAnonymous", e.DEANONYMIZE_USER = "deanonymizeUser", e.SET_SESSION_ID_STRICT_PRIVACY_MODE = "setSessionIdStrictPrivacyMode", e.DISABLE_COOKIES = "disableCookies", e.ENABLE_COOKIES = "enableCookies", e.DELETE_COOKIES = "deleteCookies", e.SET_COOKIE_NAME_PREFIX = "setCookieNamePrefix", e.SET_COOKIE_DOMAIN = "setCookieDomain", e.SET_COOKIE_PATH = "setCookiePath", e.SET_SECURE_COOKIE = "setSecureCookie", e.SET_VISITOR_COOKIE_TIMEOUT = "setVisitorCookieTimeout", e.SET_SESSION_COOKIE_TIMEOUT = "setSessionCookieTimeout", e.SET_VISITOR_ID_COOKIE = "setVisitorIdCookie", e.SET_REFERRAL_COOKIE_TIMEOUT = "setReferralCookieTimeout", e.SET_DOCUMENT_TITLE = "setDocumentTitle", e.SET_DOMAINS = "setDomains", e.SET_CUSTOM_URL = "setCustomUrl", e.SET_REFERRER_URL = "setReferrerUrl", e.SET_API_URL = "setApiUrl", e.GET_PIWIK_URL = "getPiwikUrl", e.GET_CURRENT_URL = "getCurrentUrl", e.DISCARD_HASH_TAG = "discardHashTag", e.SET_GENERATION_TIME_MS = "setGenerationTimeMs", e.APPEND_TO_TRACKING_URL = "appendToTrackingUrl", e.SET_DO_NOT_TRACK = "setDoNotTrack", e.KILL_FRAME = "killFrame", e.REDIRECT_FILE = "redirectFile", e.SET_CAMPAIGN_NAME_KEY = "setCampaignNameKey", e.SET_CAMPAIGN_KEYWORD_KEY = "setCampaignKeywordKey", e.PING = "ping", e.ADD_LISTENER = "addListener", e.SET_REQUEST_METHOD = "setRequestMethod", e.SET_CUSTOM_REQUEST_PROCESSING = "setCustomRequestProcessing", e.SET_REQUEST_CONTENT_TYPE = "setRequestContentType", e.ENABLE_JS_ERROR_TRACKING = "enableJSErrorTracking", e.ERROR = "trackError", e.SET_TRACKING_SOURCE = "setTrackingSource";
})(i || (i = {}));
function t(e) {
return window._paq || (window._paq = []), window._paq.push(["setCustomUrl", window.location.href]), window._paq.push(["setDocumentTitle", document.title]), E && console.log("Push", e), window._paq.push(e);
function getInitScript({ containerId, containerUrl }) {
return `(function(window, document, dataLayerName, id) {
window[dataLayerName]=window[dataLayerName]||[],window[dataLayerName].push({start:(new Date).getTime(),event:"stg.start"});var scripts=document.getElementsByTagName('script')[0],tags=document.createElement('script');
function stgCreateCookie(a,b,c){var d="";if(c){var e=new Date;e.setTime(e.getTime()+24*c*60*60*1e3),d="; expires="+e.toUTCString();f="; SameSite=Strict"}document.cookie=a+"="+b+d+f+"; path=/"}
var isStgDebug=(window.location.href.match("stg_debug")||document.cookie.match("stg_debug"))&&!window.location.href.match("stg_disable_debug");stgCreateCookie("stg_debug",isStgDebug?1:"",isStgDebug?14:-1);
var qP=[];dataLayerName!=="dataLayer"&&qP.push("data_layer_name="+dataLayerName),isStgDebug&&qP.push("stg_debug");var qPString=qP.length>0?("?"+qP.join("&")):"";
tags.async=!0,tags.src="${containerUrl}/"+id+".js"+qPString,scripts.parentNode.insertBefore(tags,scripts);
!function(a,n,i){a[n]=a[n]||{};for(var c=0;c<i.length;c++)!function(i){a[n][i]=a[n][i]||{},a[n][i].api=a[n][i].api||function(){var a=[].slice.call(arguments,0);"string"==typeof a[0]&&window[dataLayerName].push({event:n+"."+i+":"+a[0],parameters:[].slice.call(arguments,1)})}}(i[c])}(window,"ppms",["tm","cm"]);
})(window, document, 'dataLayer', '${containerId}');`;
}
function O(e) {
t([i.PAGE_VIEW, ...e ? [e] : []]);
const IS_DEBUG = typeof process !== "undefined" && process.env.NODE_ENV === "development" || typeof window !== "undefined" && window.IS_DEBUG || false;
var ECOMMERCE_TRACK_EVENT;
(function(ECOMMERCE_TRACK_EVENT2) {
ECOMMERCE_TRACK_EVENT2["TRACK_ECOMMERCE_CART_UPDATE"] = "trackEcommerceCartUpdate";
ECOMMERCE_TRACK_EVENT2["TRACK_ECOMMERCE_ORDER"] = "trackEcommerceOrder";
ECOMMERCE_TRACK_EVENT2["REMOVE_ECOMMERCE_ITEM"] = "removeEcommerceItem";
ECOMMERCE_TRACK_EVENT2["SET_ECOMMERCE_VIEW"] = "setEcommerceView";
ECOMMERCE_TRACK_EVENT2["CLEAR_ECOMMERCE_CART"] = "clearEcommerceCart";
ECOMMERCE_TRACK_EVENT2["ADD_ECOMMERCE_ITEM"] = "addEcommerceItem";
})(ECOMMERCE_TRACK_EVENT || (ECOMMERCE_TRACK_EVENT = {}));
var ECOMMERCE_V2_TRACK_EVENT;
(function(ECOMMERCE_V2_TRACK_EVENT2) {
ECOMMERCE_V2_TRACK_EVENT2["ECOMMERCE_ADD_TO_CART"] = "ecommerceAddToCart";
ECOMMERCE_V2_TRACK_EVENT2["ECOMMERCE_REMOVE_FROM_CART"] = "ecommerceRemoveFromCart";
ECOMMERCE_V2_TRACK_EVENT2["ECOMMERCE_PRODUCT_DETAIL_VIEW"] = "ecommerceProductDetailView";
ECOMMERCE_V2_TRACK_EVENT2["ECOMMERCE_CART_UPDATE"] = "ecommerceCartUpdate";
ECOMMERCE_V2_TRACK_EVENT2["ECOMMERCE_ORDER"] = "ecommerceOrder";
})(ECOMMERCE_V2_TRACK_EVENT || (ECOMMERCE_V2_TRACK_EVENT = {}));
var COOKIE_TRACK_EVENT;
(function(COOKIE_TRACK_EVENT2) {
COOKIE_TRACK_EVENT2["DISABLE_COOKIES"] = "disableCookies";
COOKIE_TRACK_EVENT2["ENABLE_COOKIES"] = "enableCookies";
COOKIE_TRACK_EVENT2["DELETE_COOKIES"] = "deleteCookies";
COOKIE_TRACK_EVENT2["SET_COOKIE_NAME_PREFIX"] = "setCookieNamePrefix";
COOKIE_TRACK_EVENT2["SET_COOKIE_DOMAIN"] = "setCookieDomain";
COOKIE_TRACK_EVENT2["SET_COOKIE_PATH"] = "setCookiePath";
COOKIE_TRACK_EVENT2["SET_SECURE_COOKIE"] = "setSecureCookie";
COOKIE_TRACK_EVENT2["SET_VISITOR_COOKIE_TIMEOUT"] = "setVisitorCookieTimeout";
COOKIE_TRACK_EVENT2["SET_SESSION_COOKIE_TIMEOUT"] = "setSessionCookieTimeout";
COOKIE_TRACK_EVENT2["SET_VISITOR_ID_COOKIE"] = "setVisitorIdCookie";
COOKIE_TRACK_EVENT2["SET_REFERRAL_COOKIE_TIMEOUT"] = "setReferralCookieTimeout";
})(COOKIE_TRACK_EVENT || (COOKIE_TRACK_EVENT = {}));
var CONTENT_TRACK_EVENT;
(function(CONTENT_TRACK_EVENT2) {
CONTENT_TRACK_EVENT2["ALL_CONTENT_IMPRESSIONS"] = "trackAllContentImpressions";
CONTENT_TRACK_EVENT2["VISIBLE_CONTENT_IMPRESSIONS"] = "trackVisibleContentImpressions";
CONTENT_TRACK_EVENT2["CONTENT_IMPRESSIONS_WITH_NODE"] = "trackContentImpressionsWithinNode";
CONTENT_TRACK_EVENT2["CONTENT_IMPRESSION"] = "trackContentImpression";
CONTENT_TRACK_EVENT2["LOG_ALL_CONTENT_BLOCKS_ON_PAGE"] = "logAllContentBlocksOnPage";
CONTENT_TRACK_EVENT2["CONTENT_INTERACTION_NODE"] = "trackContentInteractionNode";
CONTENT_TRACK_EVENT2["CONTENT_INTERACTION"] = "trackContentInteraction";
})(CONTENT_TRACK_EVENT || (CONTENT_TRACK_EVENT = {}));
var CUSTOM_DIMENSIONS_TRACK_EVENT;
(function(CUSTOM_DIMENSIONS_TRACK_EVENT2) {
CUSTOM_DIMENSIONS_TRACK_EVENT2["SET_CUSTOM_DIMENSION_VALUE"] = "setCustomDimensionValue";
CUSTOM_DIMENSIONS_TRACK_EVENT2["DELETE_CUSTOM_DIMENSION"] = "deleteCustomDimension";
CUSTOM_DIMENSIONS_TRACK_EVENT2["SET_CUSTOM_DIMENSION"] = "setCustomDimension";
})(CUSTOM_DIMENSIONS_TRACK_EVENT || (CUSTOM_DIMENSIONS_TRACK_EVENT = {}));
var CUSTOM_EVENT_TRACK_EVENT;
(function(CUSTOM_EVENT_TRACK_EVENT2) {
CUSTOM_EVENT_TRACK_EVENT2["CUSTOM_EVENT"] = "trackEvent";
})(CUSTOM_EVENT_TRACK_EVENT || (CUSTOM_EVENT_TRACK_EVENT = {}));
var DOWNLOAD_AND_OUTLINK_TRACK_EVENT;
(function(DOWNLOAD_AND_OUTLINK_TRACK_EVENT2) {
DOWNLOAD_AND_OUTLINK_TRACK_EVENT2["LINK"] = "trackLink";
DOWNLOAD_AND_OUTLINK_TRACK_EVENT2["ENABLE_LINK_TRACKING"] = "enableLinkTracking";
DOWNLOAD_AND_OUTLINK_TRACK_EVENT2["SET_IGNORE_CLASSES"] = "setIgnoreClasses";
DOWNLOAD_AND_OUTLINK_TRACK_EVENT2["SET_LINK_CLASSES"] = "setLinkClasses";
DOWNLOAD_AND_OUTLINK_TRACK_EVENT2["SET_DOWNLOAD_CLASSES"] = "setDownloadClasses";
DOWNLOAD_AND_OUTLINK_TRACK_EVENT2["SET_DOWNLOAD_EXTENSIONS"] = "setDownloadExtensions";
DOWNLOAD_AND_OUTLINK_TRACK_EVENT2["ADD_DOWNLOAD_EXTENSIONS"] = "addDownloadExtensions";
DOWNLOAD_AND_OUTLINK_TRACK_EVENT2["REMOVE_DOWNLOAD_EXTENSIONS"] = "removeDownloadExtensions";
DOWNLOAD_AND_OUTLINK_TRACK_EVENT2["SET_LINK_TRACKING_TIMER"] = "setLinkTrackingTimer";
})(DOWNLOAD_AND_OUTLINK_TRACK_EVENT || (DOWNLOAD_AND_OUTLINK_TRACK_EVENT = {}));
var GOAL_CONVERSIONS_TRACK_EVENT;
(function(GOAL_CONVERSIONS_TRACK_EVENT2) {
GOAL_CONVERSIONS_TRACK_EVENT2["GOAL"] = "trackGoal";
})(GOAL_CONVERSIONS_TRACK_EVENT || (GOAL_CONVERSIONS_TRACK_EVENT = {}));
var PAGE_VIEWS_TRACK_EVENT;
(function(PAGE_VIEWS_TRACK_EVENT2) {
PAGE_VIEWS_TRACK_EVENT2["PAGE_VIEW"] = "trackPageView";
})(PAGE_VIEWS_TRACK_EVENT || (PAGE_VIEWS_TRACK_EVENT = {}));
var SITE_SEARCH_TRACK_EVENT;
(function(SITE_SEARCH_TRACK_EVENT2) {
SITE_SEARCH_TRACK_EVENT2["SEARCH"] = "trackSiteSearch";
})(SITE_SEARCH_TRACK_EVENT || (SITE_SEARCH_TRACK_EVENT = {}));
var USER_MANAGEMENT_TRACK_EVENT;
(function(USER_MANAGEMENT_TRACK_EVENT2) {
USER_MANAGEMENT_TRACK_EVENT2["SET_USER_ID"] = "setUserId";
USER_MANAGEMENT_TRACK_EVENT2["RESET_USER_ID"] = "resetUserId";
})(USER_MANAGEMENT_TRACK_EVENT || (USER_MANAGEMENT_TRACK_EVENT = {}));
var PAQ_SERVICE_TRACK_EVENT;
(function(PAQ_SERVICE_TRACK_EVENT2) {
PAQ_SERVICE_TRACK_EVENT2["SET_CUSTOM_URL"] = "setCustomUrl";
PAQ_SERVICE_TRACK_EVENT2["SET_DOCUMENT_TITLE"] = "setDocumentTitle";
})(PAQ_SERVICE_TRACK_EVENT || (PAQ_SERVICE_TRACK_EVENT = {}));
function push$1(collection) {
if (!window._paq) {
window._paq = [];
}
window._paq.push([
PAQ_SERVICE_TRACK_EVENT.SET_CUSTOM_URL,
window.location.href
]);
window._paq.push([PAQ_SERVICE_TRACK_EVENT.SET_DOCUMENT_TITLE, document.title]);
IS_DEBUG && console.log("Push", collection);
return window._paq.push(collection);
}
const me = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
function trackPageView(customPageTitle) {
push$1([
PAGE_VIEWS_TRACK_EVENT.PAGE_VIEW,
...customPageTitle ? [customPageTitle] : []
]);
}
const pageViews_service = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
trackPageView: O
trackPageView
}, Symbol.toStringTag, { value: "Module" }));
function u(e, n, o, r, s) {
t([
i.ADD_ECOMMERCE_ITEM,
e,
n,
o,
r,
s
]);
function trackEvent(category, action, name, value, dimensions) {
const eventArguments = [
category,
action,
...name ? [name] : [],
...name ? [value] : [],
...dimensions ? [dimensions] : []
];
push$1([CUSTOM_EVENT_TRACK_EVENT.CUSTOM_EVENT, ...eventArguments]);
}
function S(e) {
t([i.ECOMMERCE_ADD_TO_CART, e]);
const customEvents_service = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
trackEvent
}, Symbol.toStringTag, { value: "Module" }));
function trackAllContentImpressions() {
push$1([CONTENT_TRACK_EVENT.ALL_CONTENT_IMPRESSIONS]);
}
function m(e) {
t([i.REMOVE_ECOMMERCE_ITEM, e]);
function trackVisibleContentImpressions(checkOnScroll = true, watchInterval = 750) {
push$1([
CONTENT_TRACK_EVENT.VISIBLE_CONTENT_IMPRESSIONS,
checkOnScroll,
watchInterval
]);
}
function I(e) {
t([i.ECOMMERCE_REMOVE_FROM_CART, e]);
function trackContentImpressionsWithinNode(domNode) {
push$1([CONTENT_TRACK_EVENT.CONTENT_IMPRESSIONS_WITH_NODE, domNode]);
}
function f() {
return new Promise((e, n) => {
try {
t([
function() {
e(this.getEcommerceItems());
}
]);
} catch (o) {
o instanceof ReferenceError && n(o);
}
});
}
function C(e, n, o, r, s, c) {
t([
i.TRACK_ECOMMERCE_ORDER,
e,
n,
o,
r,
s,
c
function trackContentImpression(contentName, contentPiece, contentTarget) {
push$1([
CONTENT_TRACK_EVENT.CONTENT_IMPRESSION,
contentName,
contentPiece,
contentTarget
]);
}
function l(e, n) {
t([i.ECOMMERCE_ORDER, e, n]);
function logAllContentBlocksOnPage() {
push$1([CONTENT_TRACK_EVENT.LOG_ALL_CONTENT_BLOCKS_ON_PAGE]);
}
function d(e) {
t([i.TRACK_ECOMMERCE_CART_UPDATE, e]);
function trackContentInteractionNode(domNode, contentInteraction = "Unknown") {
push$1([
CONTENT_TRACK_EVENT.CONTENT_INTERACTION_NODE,
domNode,
contentInteraction
]);
}
function M(e, n) {
t([i.ECOMMERCE_CART_UPDATE, e, n]);
function trackContentInteraction(contentInteraction, contentName, contentPiece, contentTarget) {
push$1([
CONTENT_TRACK_EVENT.CONTENT_INTERACTION,
contentInteraction,
contentName,
contentPiece,
contentTarget
]);
}
function D(e) {
t([i.ECOMMERCE_PRODUCT_DETAIL_VIEW, e]);
const contentTracking_service = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
logAllContentBlocksOnPage,
trackAllContentImpressions,
trackContentImpression,
trackContentImpressionsWithinNode,
trackContentInteraction,
trackContentInteractionNode,
trackVisibleContentImpressions
}, Symbol.toStringTag, { value: "Module" }));
function disableCookies() {
push$1([COOKIE_TRACK_EVENT.DISABLE_COOKIES]);
}
function g() {
t([i.CLEAR_ECOMMERCE_CART]);
function enableCookies() {
push$1([COOKIE_TRACK_EVENT.ENABLE_COOKIES]);
}
function k(e, n, o, r) {
t([
i.SET_ECOMMERCE_VIEW,
e,
n,
o,
r
]);
function deleteCookies() {
push$1([COOKIE_TRACK_EVENT.DELETE_COOKIES]);
}
const Ie = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
addEcommerceItem: u,
clearEcommerceCart: g,
ecommerceAddToCart: S,
ecommerceCartUpdate: M,
ecommerceOrder: l,
ecommerceProductDetailView: D,
ecommerceRemoveFromCart: I,
getEcommerceItems: f,
removeEcommerceItem: m,
setEcommerceView: k,
trackEcommerceCartUpdate: d,
trackEcommerceOrder: C
}, Symbol.toStringTag, { value: "Module" }));
function T() {
return new Promise((e, n) => {
function hasCookies() {
return new Promise((resolve, reject) => {
try {
t([
push$1([
function() {
e(this.getUserId());
resolve(this.hasCookies());
}
]);
} catch (o) {
o instanceof ReferenceError && n(o);
} catch (e) {
if (e instanceof ReferenceError) {
reject(e);
}
}
});
}
function L(e) {
t([i.SET_USER_ID, e]);
function getCookieDomain() {
return new Promise((resolve, reject) => {
try {
push$1([
function() {
resolve(this.getCookieDomain());
}
]);
} catch (e) {
if (e instanceof ReferenceError) {
reject(e);
}
}
});
}
function R() {
t([i.RESET_USER_ID]);
function getCookiePath() {
return new Promise((resolve, reject) => {
try {
push$1([
function() {
resolve(this.getCookiePath());
}
]);
} catch (e) {
if (e instanceof ReferenceError) {
reject(e);
}
}
});
}
function p() {
return new Promise((e, n) => {
function getConfigVisitorCookieTimeout() {
return new Promise((resolve, reject) => {
try {
t([
push$1([
function() {
e(this.getVisitorId());
resolve(this.getConfigVisitorCookieTimeout());
}
]);
} catch (o) {
o instanceof ReferenceError && n(o);
} catch (e) {
if (e instanceof ReferenceError) {
reject(e);
}
}
});
}
function P() {
return new Promise((e, n) => {
function setReferralCookieTimeout(seconds) {
push$1([COOKIE_TRACK_EVENT.SET_REFERRAL_COOKIE_TIMEOUT, seconds]);
}
function getSessionCookieTimeout() {
return new Promise((resolve, reject) => {
try {
t([
push$1([
function() {
e(this.getVisitorInfo());
resolve(this.getSessionCookieTimeout());
}
]);
} catch (o) {
o instanceof ReferenceError && n(o);
} catch (e) {
if (e instanceof ReferenceError) {
reject(e);
}
}
});
}
const fe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
getUserId: T,
getVisitorId: p,
getVisitorInfo: P,
resetUserId: R,
setUserId: L
}, Symbol.toStringTag, { value: "Module" }));
function N(e, n, o, r) {
const s = [
e,
n,
...o ? [o] : [],
...o ? [r] : []
];
t([i.CUSTOM_EVENT, ...s]);
function setCookieNamePrefix(prefix) {
push$1([COOKIE_TRACK_EVENT.SET_COOKIE_NAME_PREFIX, prefix]);
}
const Ce = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
trackEvent: N
}, Symbol.toStringTag, { value: "Module" }));
function w() {
t([i.ALL_CONTENT_IMPRESSIONS]);
function setCookieDomain(domain) {
push$1([COOKIE_TRACK_EVENT.SET_COOKIE_DOMAIN, domain]);
}
function U(e, n) {
t([i.VISIBLE_CONTENT_IMPRESSIONS, e, n]);
function setCookiePath(path) {
push$1([COOKIE_TRACK_EVENT.SET_COOKIE_PATH, path]);
}
function h(e) {
t([i.CONTENT_IMPRESSIONS_WITH_NODE, e]);
function setSecureCookie(secure) {
push$1([COOKIE_TRACK_EVENT.SET_SECURE_COOKIE, secure]);
}
function y(e, n, o) {
t([
i.CONTENT_IMPRESSION,
e,
n,
o
]);
function setVisitorCookieTimeout(seconds) {
push$1([COOKIE_TRACK_EVENT.SET_VISITOR_COOKIE_TIMEOUT, seconds]);
}
function b() {
t([i.LOG_ALL_CONTENT_BLOCKS_ON_PAGE]);
function setSessionCookieTimeout(seconds) {
push$1([COOKIE_TRACK_EVENT.SET_SESSION_COOKIE_TIMEOUT, seconds]);
}
function v(e, n) {
t([i.CONTENT_INTERACTION_NODE, e, n]);
function setVisitorIdCookie() {
push$1([COOKIE_TRACK_EVENT.SET_VISITOR_ID_COOKIE]);
}
function A(e, n, o, r) {
t([
i.CONTENT_INTERACTION,
e,
n,
o,
r
]);
}
const le = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
const cookieManagement_service = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
logAllContentBlocksOnPage: b,
trackAllContentImpressions: w,
trackContentImpression: y,
trackContentImpressionsWithinNode: h,
trackContentInteraction: A,
trackContentInteractionNode: v,
trackVisibleContentImpressions: U
deleteCookies,
disableCookies,
enableCookies,
getConfigVisitorCookieTimeout,
getCookieDomain,
getCookiePath,
getSessionCookieTimeout,
hasCookies,
setCookieDomain,
setCookieNamePrefix,
setCookiePath,
setReferralCookieTimeout,
setSecureCookie,
setSessionCookieTimeout,
setVisitorCookieTimeout,
setVisitorIdCookie
}, Symbol.toStringTag, { value: "Module" }));
function G(e, n, o) {
t([
i.GOAL,
e,
n,
...o ? [{ ...o }] : []
function setCustomDimensionValue(customDimensionId, customDimensionValue) {
push$1([
CUSTOM_DIMENSIONS_TRACK_EVENT.SET_CUSTOM_DIMENSION_VALUE,
customDimensionId,
customDimensionValue
]);
}
const de = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
function deleteCustomDimension(customDimensionId) {
push$1([
CUSTOM_DIMENSIONS_TRACK_EVENT.DELETE_CUSTOM_DIMENSION,
customDimensionId
]);
}
function getCustomDimensionValue(customDimensionId) {
return new Promise((resolve, reject) => {
try {
push$1([
function() {
resolve(this.getCustomDimensionValue(customDimensionId));
}
]);
} catch (e) {
if (e instanceof ReferenceError) {
reject(e);
}
}
});
}
const customDimensions_service = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
trackGoal: G
deleteCustomDimension,
getCustomDimensionValue,
setCustomDimensionValue
}, Symbol.toStringTag, { value: "Module" }));
function B(e, n, o, r) {
t([i.LINK, e, n, o, r]);
function trackLink(url, linkType, dimensions, callback) {
push$1([
DOWNLOAD_AND_OUTLINK_TRACK_EVENT.LINK,
url,
linkType,
dimensions,
callback
]);
}
function W(e) {
t([i.ENABLE_LINK_TRACKING, e]);
function enableLinkTracking(trackAlsoMiddleAndRightClicks = true) {
push$1([
DOWNLOAD_AND_OUTLINK_TRACK_EVENT.ENABLE_LINK_TRACKING,
trackAlsoMiddleAndRightClicks
]);
}
function j(e) {
t([i.SET_LINK_CLASSES, e]);
function setLinkClasses(classes) {
push$1([DOWNLOAD_AND_OUTLINK_TRACK_EVENT.SET_LINK_CLASSES, classes]);
}
function q(e) {
t([i.SET_DOWNLOAD_CLASSES, e]);
function setDownloadClasses(classes) {
push$1([DOWNLOAD_AND_OUTLINK_TRACK_EVENT.SET_DOWNLOAD_CLASSES, classes]);
}
function x(e) {
t([i.SET_DOWNLOAD_EXTENSIONS, e]);
function setDownloadExtensions(extensions) {
push$1([DOWNLOAD_AND_OUTLINK_TRACK_EVENT.SET_DOWNLOAD_EXTENSIONS, extensions]);
}
function F(e) {
t([i.ADD_DOWNLOAD_EXTENSIONS, e]);
function addDownloadExtensions(extensions) {
push$1([DOWNLOAD_AND_OUTLINK_TRACK_EVENT.ADD_DOWNLOAD_EXTENSIONS, extensions]);
}
function z(e) {
t([i.REMOVE_DOWNLOAD_EXTENSIONS, e]);
function removeDownloadExtensions(extensions) {
push$1([
DOWNLOAD_AND_OUTLINK_TRACK_EVENT.REMOVE_DOWNLOAD_EXTENSIONS,
extensions
]);
}
function H(e) {
t([i.SET_LINK_TRACKING_TIMER, e]);
function setLinkTrackingTimer(time) {
push$1([DOWNLOAD_AND_OUTLINK_TRACK_EVENT.SET_LINK_TRACKING_TIMER, time]);
}
function X() {
return new Promise((e, n) => {
function getLinkTrackingTimer() {
return new Promise((resolve, reject) => {
try {
t([
push$1([
function() {
e(this.getLinkTrackingTimer());
resolve(this.getLinkTrackingTimer());
}
]);
} catch (o) {
o instanceof ReferenceError && n(o);
} catch (e) {
if (e instanceof ReferenceError) {
reject(e);
}
}
});
}
function Y(e) {
t([i.SET_IGNORE_CLASSES, e]);
function setIgnoreClasses(classes) {
push$1([DOWNLOAD_AND_OUTLINK_TRACK_EVENT.SET_IGNORE_CLASSES, classes]);
}
const Me = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
const downloadAndOutlink_service = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
addDownloadExtensions: F,
enableLinkTracking: W,
getLinkTrackingTimer: X,
removeDownloadExtensions: z,
setDownloadClasses: q,
setDownloadExtensions: x,
setIgnoreClasses: Y,
setLinkClasses: j,
setLinkTrackingTimer: H,
trackLink: B
addDownloadExtensions,
enableLinkTracking,
getLinkTrackingTimer,
removeDownloadExtensions,
setDownloadClasses,
setDownloadExtensions,
setIgnoreClasses,
setLinkClasses,
setLinkTrackingTimer,
trackLink
}, Symbol.toStringTag, { value: "Module" }));
function Q(e, n, o, r) {
t([i.SEARCH, e, n, o, r]);
}
const De = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
trackSiteSearch: Q
}, Symbol.toStringTag, { value: "Module" }));
function $(e, n) {
t([
i.SET_CUSTOM_DIMENSION_VALUE,
e,
n
function addEcommerceItem(productSKU, productName, productCategory, productPrice, productQuantity) {
push$1([
ECOMMERCE_TRACK_EVENT.ADD_ECOMMERCE_ITEM,
productSKU,
productName,
productCategory,
productPrice,
productQuantity
]);
}
function J(e) {
t([i.DELETE_CUSTOM_DIMENSION, e]);
function ecommerceAddToCart(products) {
push$1([ECOMMERCE_V2_TRACK_EVENT.ECOMMERCE_ADD_TO_CART, products]);
}
function Z(e) {
return new Promise((n, o) => {
function removeEcommerceItem(productSKU) {
push$1([ECOMMERCE_TRACK_EVENT.REMOVE_ECOMMERCE_ITEM, productSKU]);
}
function ecommerceRemoveFromCart(products) {
push$1([ECOMMERCE_V2_TRACK_EVENT.ECOMMERCE_REMOVE_FROM_CART, products]);
}
function getEcommerceItems() {
return new Promise((resolve, reject) => {
try {
t([
push$1([
function() {
n(this.getCustomDimensionValue(e));
resolve(this.getEcommerceItems());
}
]);
} catch (r) {
r instanceof ReferenceError && o(r);
} catch (e) {
if (e instanceof ReferenceError) {
reject(e);
}
}
});
}
const ge = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
function trackEcommerceOrder(orderId, orderGrandTotal, orderSubTotal, orderTax, orderShipping, orderDiscount) {
push$1([
ECOMMERCE_TRACK_EVENT.TRACK_ECOMMERCE_ORDER,
orderId,
orderGrandTotal,
orderSubTotal,
orderTax,
orderShipping,
orderDiscount
]);
}
function ecommerceOrder(products, paymentInformation) {
push$1([ECOMMERCE_V2_TRACK_EVENT.ECOMMERCE_ORDER, products, paymentInformation]);
}
function trackEcommerceCartUpdate(cartAmount) {
push$1([ECOMMERCE_TRACK_EVENT.TRACK_ECOMMERCE_CART_UPDATE, cartAmount]);
}
function ecommerceCartUpdate(products, grandTotal) {
push$1([ECOMMERCE_V2_TRACK_EVENT.ECOMMERCE_CART_UPDATE, products, grandTotal]);
}
function ecommerceProductDetailView(products) {
push$1([ECOMMERCE_V2_TRACK_EVENT.ECOMMERCE_PRODUCT_DETAIL_VIEW, products]);
}
function clearEcommerceCart() {
push$1([ECOMMERCE_TRACK_EVENT.CLEAR_ECOMMERCE_CART]);
}
function setEcommerceView(productSKU, productName, productCategory, productPrice) {
push$1([
ECOMMERCE_TRACK_EVENT.SET_ECOMMERCE_VIEW,
productSKU,
productName,
productCategory,
productPrice
]);
}
const eCommerce_service = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
deleteCustomDimension: J,
getCustomDimensionValue: Z,
setCustomDimensionValue: $
addEcommerceItem,
clearEcommerceCart,
ecommerceAddToCart,
ecommerceCartUpdate,
ecommerceOrder,
ecommerceProductDetailView,
ecommerceRemoveFromCart,
getEcommerceItems,
removeEcommerceItem,
setEcommerceView,
trackEcommerceCartUpdate,
trackEcommerceOrder
}, Symbol.toStringTag, { value: "Module" }));
function V() {
t([i.DISABLE_COOKIES]);
function trackGoal(goalId, conversionValue, dimensions) {
push$1([
GOAL_CONVERSIONS_TRACK_EVENT.GOAL,
goalId,
conversionValue,
...dimensions ? [{ ...dimensions }] : []
]);
}
function K() {
t([i.ENABLE_COOKIES]);
const goalConversions_service = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
trackGoal
}, Symbol.toStringTag, { value: "Module" }));
function trackSiteSearch(keyword, category, searchCount, dimensions) {
push$1([
SITE_SEARCH_TRACK_EVENT.SEARCH,
keyword,
category,
searchCount,
dimensions
]);
}
function ee() {
t([i.DELETE_COOKIES]);
}
function te() {
return new Promise((e, n) => {
const siteSearch_service = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
trackSiteSearch
}, Symbol.toStringTag, { value: "Module" }));
function getUserId() {
return new Promise((resolve, reject) => {
try {
t([
push$1([
function() {
e(this.hasCookies());
resolve(this.getUserId());
}
]);
} catch (o) {
o instanceof ReferenceError && n(o);
} catch (e) {
if (e instanceof ReferenceError) {
reject(e);
}
}
});
}
function oe() {
return new Promise((e, n) => {
try {
t([
function() {
e(this.getCookieDomain());
}
]);
} catch (o) {
o instanceof ReferenceError && n(o);
}
});
function setUserId(userId) {
push$1([USER_MANAGEMENT_TRACK_EVENT.SET_USER_ID, userId]);
}
function ne() {
return new Promise((e, n) => {
try {
t([
function() {
e(this.getCookiePath());
}
]);
} catch (o) {
o instanceof ReferenceError && n(o);
}
});
function resetUserId() {
push$1([USER_MANAGEMENT_TRACK_EVENT.RESET_USER_ID]);
}
function ie() {
return new Promise((e, n) => {
function getVisitorId() {
return new Promise((resolve, reject) => {
try {
t([
push$1([
function() {
e(this.getConfigVisitorCookieTimeout());
resolve(this.getVisitorId());
}
]);
} catch (o) {
o instanceof ReferenceError && n(o);
} catch (e) {
if (e instanceof ReferenceError) {
reject(e);
}
}
});
}
function re(e) {
t([i.SET_REFERRAL_COOKIE_TIMEOUT, e]);
}
function se() {
return new Promise((e, n) => {
function getVisitorInfo() {
return new Promise((resolve, reject) => {
try {
t([
push$1([
function() {
e(this.getSessionCookieTimeout());
resolve(this.getVisitorInfo());
}
]);
} catch (o) {
o instanceof ReferenceError && n(o);
} catch (e) {
if (e instanceof ReferenceError) {
reject(e);
}
}
});
}
function ce(e) {
t([i.SET_COOKIE_NAME_PREFIX, e]);
const userManagement_service = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
getUserId,
getVisitorId,
getVisitorInfo,
resetUserId,
setUserId
}, Symbol.toStringTag, { value: "Module" }));
function push(data) {
if (!window.dataLayer) {
window.dataLayer = [];
}
IS_DEBUG && console.log("DataLayer push", data);
return window.dataLayer.push(data);
}
function ae(e) {
t([i.SET_COOKIE_DOMAIN, e]);
}
function Ee(e) {
t([i.SET_COOKIE_PATH, e]);
}
function _e(e) {
t([i.SET_SECURE_COOKIE, e]);
}
function Oe(e) {
t([i.SET_VISITOR_COOKIE_TIMEOUT, e]);
}
function ue(e) {
t([i.SET_SESSION_COOKIE_TIMEOUT, e]);
}
function Se() {
t([i.SET_VISITOR_ID_COOKIE]);
}
const ke = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
const dataLayer_service = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
deleteCookies: ee,
disableCookies: V,
enableCookies: K,
getConfigVisitorCookieTimeout: ie,
getCookieDomain: oe,
getCookiePath: ne,
getSessionCookieTimeout: se,
hasCookies: te,
setCookieDomain: ae,
setCookieNamePrefix: ce,
setCookiePath: Ee,
setReferralCookieTimeout: re,
setSecureCookie: _e,
setSessionCookieTimeout: ue,
setVisitorCookieTimeout: Oe,
setVisitorIdCookie: Se
}, Symbol.toStringTag, { value: "Module" })), Te = {
initialize: _.init
push
}, Symbol.toStringTag, { value: "Module" }));
const index = {
initialize: init,
getInitScript
};
export {
le as ContentTracking,
ke as CookieManagement,
ge as CustomDimensions,
Ce as CustomEvent,
Me as DownloadAndOutlink,
de as GoalConversions,
me as PageViews,
De as SiteSearch,
fe as UserManagement,
Te as default,
Ie as eCommerce
contentTracking_service as ContentTracking,
cookieManagement_service as CookieManagement,
customDimensions_service as CustomDimensions,
customEvents_service as CustomEvent,
dataLayer_service as DataLayer,
downloadAndOutlink_service as DownloadAndOutlink,
goalConversions_service as GoalConversions,
pageViews_service as PageViews,
siteSearch_service as SiteSearch,
userManagement_service as UserManagement,
index as default,
eCommerce_service as eCommerce
};
//# sourceMappingURL=index.js.map
{
"name": "@piwikpro/vue-piwik-pro",
"private": false,
"version": "1.0.0",
"version": "1.1.0",
"type": "module",

@@ -28,6 +28,8 @@ "author": "Piwik Pro Integration Team <integrations@piwik.pro>",

"build": "vue-tsc && vite build",
"build:docs": "typedoc && concat-md docs_raw > README.md && node scripts/postProcessDocs.js",
"preview": "vite preview",
"lint": "eslint --ext .js,.vue,.ts src",
"format": "prettier --write .",
"test": "jest"
"test": "jest",
"typecheck": "tsc --noEmit"
},

@@ -50,2 +52,3 @@ "peerDependencies": {

"babel-plugin-transform-import-meta": "^2.2.1",
"concat-md": "^0.5.1",
"eslint": "^8.56.0",

@@ -61,2 +64,4 @@ "eslint-config-prettier": "^9.1.0",

"tslib": "^2.6.2",
"typedoc": "^0.25.13",
"typedoc-plugin-markdown": "^3.17.1",
"typescript": "^5.2.2",

@@ -71,3 +76,6 @@ "vite": "^5.0.8",

"plugin"
]
],
"dependencies": {
"@piwikpro/tracking-base-library": "^1.1.2"
}
}

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

<a name="readmemd"></a>
# Piwik PRO Library for VUE

@@ -5,6 +9,2 @@

* [Installation](#installation)
* [NPM](#npm)
* [Basic setup](#basic-setup)
## Installation

@@ -20,6 +20,5 @@

### Basic setup
In your Vue Project, include the default `PiwikPro` in the highest level application module. ie `main`. To set up the Piwik PRO Tag Manager container in the app, the easiest way is to call the `PiwikPro.initialize()` method. `PiwikPro.initialize()` must be initialized using this function before any of the other tracking functions will record any data.
In your Vue Project, include the default `VuePiwikPro` in the highest level application module. ie `main`. To set up the Piwik PRO Tag Manager container in the app, the easiest way is to call the `VuePiwikPro.initialize()` method. `VuePiwikPro.initialize()` must be initialized using this function before any of the other tracking functions will record any data.

@@ -55,4 +54,1259 @@ In the arguments, pass your app ID and your account URL as parameters (marked 'container-id' and 'container-url' in the example below).

### Basic usage
```ts
import { PageViews, GoalConversions } from "@piwikpro/vue-piwik-pro"
PageViews.trackPageView();
GoalConversions.trackGoal(1, 100);
```
## Examples of usage
Please explore the ```./vue-piwik-pro-example``` directory to get to know how to use this package with a specyfic examples and it's various methods.
Please explore the ```./vue-piwik-pro-example``` directory to get to know how to use this package with a specific examples and it's various methods.
<a name="modulesmd"></a>
## Table of contents
### Namespaces
- [ContentTracking](#modulescontenttrackingmd)
- [CookieManagement](#modulescookiemanagementmd)
- [CustomDimensions](#modulescustomdimensionsmd)
- [CustomEvent](#modulescustomeventmd)
- [DataLayer](#modulesdatalayermd)
- [DownloadAndOutlink](#modulesdownloadandoutlinkmd)
- [GoalConversions](#modulesgoalconversionsmd)
- [PageViews](#modulespageviewsmd)
- [SiteSearch](#modulessitesearchmd)
- [UserManagement](#modulesusermanagementmd)
- [eCommerce](#modulesecommercemd)
### Type Aliases
- [Dimensions](#dimensions)
- [PaymentInformation](#paymentinformation)
- [Product](#product)
- [VisitorInfo](#visitorinfo)
### Variables
- [default](#default)
## Type Aliases
### Dimensions
Ƭ **Dimensions**: `Record`\<\`dimension$\{number}\`, `string`\>
___
### PaymentInformation
Ƭ **PaymentInformation**: `Object`
#### Type declaration
| Name | Type |
| :------ | :------ |
| `discount?` | `number` \| `string` |
| `grandTotal` | `number` \| `string` |
| `orderId` | `string` |
| `shipping?` | `number` \| `string` |
| `subTotal?` | `number` \| `string` |
| `tax?` | `number` \| `string` |
___
### Product
Ƭ **Product**: `Object`
#### Type declaration
| Name | Type |
| :------ | :------ |
| `brand?` | `string` |
| `category?` | `LimitedArrayFiveStrings` |
| `customDimensions?` | `Record`\<`number`, `string`\> |
| `name?` | `string` |
| `price?` | `number` |
| `quantity?` | `number` |
| `sku` | `string` |
| `variant?` | `string` |
___
### VisitorInfo
Ƭ **VisitorInfo**: [isNew: "0" \| "1", visitorId: string, firstVisitTS: number, previousVisitCount: string \| number, currentVisitTS: number, lastVisitTS: number \| "", lastEcommerceOrderTS: number \| ""]
## Variables
### default
• `Const` **default**: `Object`
#### Type declaration
| Name | Type |
| :------ | :------ |
| `getInitScript` | typeof `PiwikPro.getInitScript` |
| `initialize` | typeof `PiwikPro.init` |
<a name="modulescontenttrackingmd"></a>
# ContentTracking
## Table of contents
- [logAllContentBlocksOnPage](#logallcontentblocksonpage)
- [trackAllContentImpressions](#trackallcontentimpressions)
- [trackContentImpression](#trackcontentimpression)
- [trackContentImpressionsWithinNode](#trackcontentimpressionswithinnode)
- [trackContentInteraction](#trackcontentinteraction)
- [trackContentInteractionNode](#trackcontentinteractionnode)
- [trackVisibleContentImpressions](#trackvisiblecontentimpressions)
## Functions
### logAllContentBlocksOnPage
▸ **logAllContentBlocksOnPage**(): `void`
Print all content blocks to the console for debugging purposes
#### Returns
`void`
___
### trackAllContentImpressions
▸ **trackAllContentImpressions**(): `void`
Scans the entire DOM for content blocks and tracks impressions after all page
elements load. It does not send duplicates on repeated calls unless
trackPageView was called in between trackAllContentImpressions invocations
#### Returns
`void`
___
### trackContentImpression
▸ **trackContentImpression**(`contentName`, `contentPiece`, `contentTarget`): `void`
#### Parameters
| Name | Type |
| :------ | :------ |
| `contentName` | `string` |
| `contentPiece` | `string` |
| `contentTarget` | `string` |
#### Returns
`void`
___
### trackContentImpressionsWithinNode
▸ **trackContentImpressionsWithinNode**(`domNode`): `void`
#### Parameters
| Name | Type |
| :------ | :------ |
| `domNode` | `Node` |
#### Returns
`void`
___
### trackContentInteraction
▸ **trackContentInteraction**(`contentInteraction`, `contentName`, `contentPiece`, `contentTarget`): `void`
Tracks manual content interaction event
#### Parameters
| Name | Type | Description |
| :------ | :------ | :------ |
| `contentInteraction` | `string` | Type of interaction (e.g. "click") |
| `contentName` | `string` | Name of a content block |
| `contentPiece` | `string` | Name of the content that was displayed (e.g. link to an image) |
| `contentTarget` | `string` | Where the content leads to (e.g. URL of some external website) |
#### Returns
`void`
___
### trackContentInteractionNode
▸ **trackContentInteractionNode**(`domNode`, `contentInteraction?`): `void`
Tracks interaction with a block in domNode. Can be called from code placed in onclick attribute
#### Parameters
| Name | Type | Description |
| :------ | :------ | :------ |
| `domNode` | `Node` | Node marked as content block or containing content blocks. If content block can’t be found, nothing will tracked. |
| `contentInteraction?` | `string` | Name of interaction (e.g. "click") |
#### Returns
`void`
___
### trackVisibleContentImpressions
▸ **trackVisibleContentImpressions**(`checkOnScroll?`, `watchInterval?`): `void`
Scans DOM for all visible content blocks and tracks impressions
#### Parameters
| Name | Type | Description |
| :------ | :------ | :------ |
| `checkOnScroll?` | `boolean` | Whether to scan for visible content on scroll event |
| `watchInterval?` | `number` | Delay, in milliseconds, between scans for new visible content. Periodic checks can be disabled by passing 0 |
#### Returns
`void`
<a name="modulescookiemanagementmd"></a>
# CookieManagement
## Table of contents
- [deleteCookies](#deletecookies)
- [disableCookies](#disablecookies)
- [enableCookies](#enablecookies)
- [getConfigVisitorCookieTimeout](#getconfigvisitorcookietimeout)
- [getCookieDomain](#getcookiedomain)
- [getCookiePath](#getcookiepath)
- [getSessionCookieTimeout](#getsessioncookietimeout)
- [hasCookies](#hascookies)
- [setCookieDomain](#setcookiedomain)
- [setCookieNamePrefix](#setcookienameprefix)
- [setCookiePath](#setcookiepath)
- [setReferralCookieTimeout](#setreferralcookietimeout)
- [setSecureCookie](#setsecurecookie)
- [setSessionCookieTimeout](#setsessioncookietimeout)
- [setVisitorCookieTimeout](#setvisitorcookietimeout)
- [setVisitorIdCookie](#setvisitoridcookie)
## Functions
### deleteCookies
▸ **deleteCookies**(): `void`
Deletes existing tracking cookies on the next page view
#### Returns
`void`
___
### disableCookies
▸ **disableCookies**(): `void`
Disables all first party cookies. Existing cookies will be deleted in the next page view
#### Returns
`void`
___
### enableCookies
▸ **enableCookies**(): `void`
Enables all first party cookies. Cookies will be created on the next tracking request
#### Returns
`void`
___
### getConfigVisitorCookieTimeout
▸ **getConfigVisitorCookieTimeout**(): `Promise`\<`number`\>
Returns expiration time of visitor cookies (in milliseconds)
#### Returns
`Promise`\<`number`\>
___
### getCookieDomain
▸ **getCookieDomain**(): `Promise`\<`string`\>
Returns domain of the analytics tracking cookies (set with setCookieDomain()).
#### Returns
`Promise`\<`string`\>
___
### getCookiePath
▸ **getCookiePath**(): `Promise`\<`string`\>
Returns the analytics tracking cookies path
#### Returns
`Promise`\<`string`\>
___
### getSessionCookieTimeout
▸ **getSessionCookieTimeout**(): `Promise`\<`number`\>
Returns expiration time of session cookies
#### Returns
`Promise`\<`number`\>
___
### hasCookies
▸ **hasCookies**(): `Promise`\<`boolean`\>
Returns true if cookies are enabled in this browser
#### Returns
`Promise`\<`boolean`\>
___
### setCookieDomain
▸ **setCookieDomain**(`domain`): `void`
Sets the domain for the analytics tracking cookies
#### Parameters
| Name | Type |
| :------ | :------ |
| `domain` | `string` |
#### Returns
`void`
___
### setCookieNamePrefix
▸ **setCookieNamePrefix**(`prefix`): `void`
Sets the prefix for analytics tracking cookies. Default is "_pk_".
#### Parameters
| Name | Type |
| :------ | :------ |
| `prefix` | `string` |
#### Returns
`void`
___
### setCookiePath
▸ **setCookiePath**(`path`): `void`
Sets the analytics tracking cookies path
#### Parameters
| Name | Type |
| :------ | :------ |
| `path` | `string` |
#### Returns
`void`
___
### setReferralCookieTimeout
▸ **setReferralCookieTimeout**(`seconds`): `void`
Sets the expiration time of referral cookies
#### Parameters
| Name | Type |
| :------ | :------ |
| `seconds` | `number` |
#### Returns
`void`
___
### setSecureCookie
▸ **setSecureCookie**(`secure`): `void`
Toggles the secure cookie flag on all first party cookies (if you are using HTTPS)
#### Parameters
| Name | Type |
| :------ | :------ |
| `secure` | `boolean` |
#### Returns
`void`
___
### setSessionCookieTimeout
▸ **setSessionCookieTimeout**(`seconds`): `void`
Sets the expiration time of session cookies
#### Parameters
| Name | Type |
| :------ | :------ |
| `seconds` | `number` |
#### Returns
`void`
___
### setVisitorCookieTimeout
▸ **setVisitorCookieTimeout**(`seconds`): `void`
Sets the expiration time of visitor cookies
#### Parameters
| Name | Type |
| :------ | :------ |
| `seconds` | `number` |
#### Returns
`void`
___
### setVisitorIdCookie
▸ **setVisitorIdCookie**(): `void`
Sets cookie containing [analytics ID](https://developers.piwik.pro/en/latest/glossary.html#term-analytics-id) in browser
#### Returns
`void`
<a name="modulescustomdimensionsmd"></a>
# CustomDimensions
## Table of contents
- [deleteCustomDimension](#deletecustomdimension)
- [getCustomDimensionValue](#getcustomdimensionvalue)
- [setCustomDimensionValue](#setcustomdimensionvalue)
## Functions
### deleteCustomDimension
▸ **deleteCustomDimension**(`customDimensionId`): `void`
Removes a custom dimension with the specified ID.
#### Parameters
| Name | Type |
| :------ | :------ |
| `customDimensionId` | `string` |
#### Returns
`void`
___
### getCustomDimensionValue
▸ **getCustomDimensionValue**(`customDimensionId`): `Promise`\<`string` \| `undefined`\>
Returns the value of a custom dimension with the specified ID.
#### Parameters
| Name | Type |
| :------ | :------ |
| `customDimensionId` | `string` \| `number` |
#### Returns
`Promise`\<`string` \| `undefined`\>
___
### setCustomDimensionValue
▸ **setCustomDimensionValue**(`customDimensionId`, `customDimensionValue`): `void`
Sets a custom dimension value to be used later.
#### Parameters
| Name | Type |
| :------ | :------ |
| `customDimensionId` | `string` \| `number` |
| `customDimensionValue` | `string` |
#### Returns
`void`
<a name="modulescustomeventmd"></a>
# CustomEvent
## Table of contents
- [trackEvent](#trackevent)
## Functions
### trackEvent
▸ **trackEvent**(`category`, `action`, `name?`, `value?`, `dimensions?`): `void`
Tracks a custom event, e.g. when a visitor interacts with the page
#### Parameters
| Name | Type |
| :------ | :------ |
| `category` | `string` |
| `action` | `string` |
| `name?` | `string` |
| `value?` | `number` |
| `dimensions?` | [`Dimensions`](#dimensions) |
#### Returns
`void`
<a name="modulesdatalayermd"></a>
# DataLayer
## Table of contents
- [push](#push)
## Functions
### push
▸ **push**(`data`): `number`
Adds entry to a data layer
#### Parameters
| Name | Type |
| :------ | :------ |
| `data` | `any` |
#### Returns
`number`
<a name="modulesdownloadandoutlinkmd"></a>
# DownloadAndOutlink
## Table of contents
- [addDownloadExtensions](#adddownloadextensions)
- [enableLinkTracking](#enablelinktracking)
- [getLinkTrackingTimer](#getlinktrackingtimer)
- [removeDownloadExtensions](#removedownloadextensions)
- [setDownloadClasses](#setdownloadclasses)
- [setDownloadExtensions](#setdownloadextensions)
- [setIgnoreClasses](#setignoreclasses)
- [setLinkClasses](#setlinkclasses)
- [setLinkTrackingTimer](#setlinktrackingtimer)
- [trackLink](#tracklink)
## Functions
### addDownloadExtensions
▸ **addDownloadExtensions**(`extensions`): `void`
Adds new extensions to the download extensions list
#### Parameters
| Name | Type |
| :------ | :------ |
| `extensions` | `string`[] |
#### Returns
`void`
___
### enableLinkTracking
▸ **enableLinkTracking**(`trackAlsoMiddleAndRightClicks?`): `void`
Enables automatic link tracking. If called with `true`, left, right and
middle clicks on links will be treated as opening a link. Opening a links to
an external site (different domain) creates an outlink event. Opening a link
to a downloadable file creates a download event
#### Parameters
| Name | Type |
| :------ | :------ |
| `trackAlsoMiddleAndRightClicks?` | `boolean` |
#### Returns
`void`
___
### getLinkTrackingTimer
▸ **getLinkTrackingTimer**(): `Promise`\<`number`\>
Returns lock/wait time after a request set by setLinkTrackingTimer
#### Returns
`Promise`\<`number`\>
___
### removeDownloadExtensions
▸ **removeDownloadExtensions**(`extensions`): `void`
Removes extensions from the download extensions list
#### Parameters
| Name | Type |
| :------ | :------ |
| `extensions` | `string`[] |
#### Returns
`void`
___
### setDownloadClasses
▸ **setDownloadClasses**(`classes`): `void`
Sets a list of class names that indicate whether a list is a download and not an outlink
#### Parameters
| Name | Type |
| :------ | :------ |
| `classes` | `string`[] |
#### Returns
`void`
___
### setDownloadExtensions
▸ **setDownloadExtensions**(`extensions`): `void`
Overwrites the list of file extensions indicating that a link is a download
#### Parameters
| Name | Type |
| :------ | :------ |
| `extensions` | `string`[] |
#### Returns
`void`
___
### setIgnoreClasses
▸ **setIgnoreClasses**(`classes`): `void`
Set a list of class names that indicate a link should not be tracked
#### Parameters
| Name | Type |
| :------ | :------ |
| `classes` | `string`[] |
#### Returns
`void`
___
### setLinkClasses
▸ **setLinkClasses**(`classes`): `void`
Sets a list of class names that indicate whether a link is an outlink and not download
#### Parameters
| Name | Type |
| :------ | :------ |
| `classes` | `string`[] |
#### Returns
`void`
___
### setLinkTrackingTimer
▸ **setLinkTrackingTimer**(`time`): `void`
When a visitor produces an events and closes the page immediately afterwards,
e.g. when opening a link, the request might get cancelled. To avoid loosing
the last event this way, JavaScript Tracking Client will lock the page for a
fraction of a second (if wait time hasn’t passed), giving the request time to
reach the Collecting & Processing Pipeline
#### Parameters
| Name | Type |
| :------ | :------ |
| `time` | `number` |
#### Returns
`void`
___
### trackLink
▸ **trackLink**(`url`, `linkType`, `dimensions?`, `callback?`): `void`
Manually tracks outlink or download event with provided values
#### Parameters
| Name | Type |
| :------ | :------ |
| `url` | `string` |
| `linkType` | `string` |
| `dimensions?` | [`Dimensions`](#dimensions) |
| `callback?` | () => `void` |
#### Returns
`void`
<a name="modulesgoalconversionsmd"></a>
# GoalConversions
## Table of contents
- [trackGoal](#trackgoal)
## Functions
### trackGoal
▸ **trackGoal**(`goalId`, `conversionValue`, `dimensions?`): `void`
Tracks manual goal conversion
#### Parameters
| Name | Type |
| :------ | :------ |
| `goalId` | `string` \| `number` |
| `conversionValue` | `number` |
| `dimensions?` | [`Dimensions`](#dimensions) |
#### Returns
`void`
<a name="modulespageviewsmd"></a>
# PageViews
## Table of contents
- [trackPageView](#trackpageview)
## Functions
### trackPageView
▸ **trackPageView**(`customPageTitle?`): `void`
Tracks a visit on the page that the function was run on
#### Parameters
| Name | Type |
| :------ | :------ |
| `customPageTitle?` | `string` |
#### Returns
`void`
<a name="modulessitesearchmd"></a>
# SiteSearch
## Table of contents
- [trackSiteSearch](#tracksitesearch)
## Functions
### trackSiteSearch
▸ **trackSiteSearch**(`keyword`, `category?`, `searchCount?`, `dimensions?`): `void`
Tracks search requests on a website
#### Parameters
| Name | Type |
| :------ | :------ |
| `keyword` | `string` |
| `category?` | `string` |
| `searchCount?` | `number` |
| `dimensions?` | [`Dimensions`](#dimensions) |
#### Returns
`void`
<a name="modulesusermanagementmd"></a>
# UserManagement
## Table of contents
- [getUserId](#getuserid)
- [getVisitorId](#getvisitorid)
- [getVisitorInfo](#getvisitorinfo)
- [resetUserId](#resetuserid)
- [setUserId](#setuserid)
## Functions
### getUserId
▸ **getUserId**(): `Promise`\<`string`\>
The function that will return user ID
#### Returns
`Promise`\<`string`\>
___
### getVisitorId
▸ **getVisitorId**(): `Promise`\<`string`\>
Returns 16-character hex ID of the visitor
#### Returns
`Promise`\<`string`\>
___
### getVisitorInfo
▸ **getVisitorInfo**(): `Promise`\<[`VisitorInfo`](#visitorinfo)\>
Returns visitor information in an array
#### Returns
`Promise`\<[`VisitorInfo`](#visitorinfo)\>
___
### resetUserId
▸ **resetUserId**(): `void`
Clears previously set userID, e.g. when visitor logs out
#### Returns
`void`
___
### setUserId
▸ **setUserId**(`userId`): `void`
User ID is an additional parameter that allows you to aggregate data. When
set up, you will be able to search through sessions by this parameter, filter
reports through it or create Multi attribution reports using User ID
#### Parameters
| Name | Type |
| :------ | :------ |
| `userId` | `string` |
#### Returns
`void`
<a name="modulesecommercemd"></a>
# eCommerce
## Table of contents
- [addEcommerceItem](#addecommerceitem)
- [clearEcommerceCart](#clearecommercecart)
- [ecommerceAddToCart](#ecommerceaddtocart)
- [ecommerceCartUpdate](#ecommercecartupdate)
- [ecommerceOrder](#ecommerceorder)
- [ecommerceProductDetailView](#ecommerceproductdetailview)
- [ecommerceRemoveFromCart](#ecommerceremovefromcart)
- [getEcommerceItems](#getecommerceitems)
- [removeEcommerceItem](#removeecommerceitem)
- [setEcommerceView](#setecommerceview)
- [trackEcommerceCartUpdate](#trackecommercecartupdate)
- [trackEcommerceOrder](#trackecommerceorder)
## Functions
### addEcommerceItem
▸ **addEcommerceItem**(`productSKU`, `productName`, `productCategory`, `productPrice`, `productQuantity`): `void`
#### Parameters
| Name | Type |
| :------ | :------ |
| `productSKU` | `string` |
| `productName` | `string` |
| `productCategory` | `string` \| `string`[] |
| `productPrice` | `number` |
| `productQuantity` | `number` |
#### Returns
`void`
**`Deprecated`**
Please use the ecommerceAddToCart instead.
___
### clearEcommerceCart
▸ **clearEcommerceCart**(): `void`
#### Returns
`void`
**`Deprecated`**
___
### ecommerceAddToCart
▸ **ecommerceAddToCart**(`products`): `void`
Tracks action of adding products to a cart
#### Parameters
| Name | Type |
| :------ | :------ |
| `products` | [`Product`](#product)[] |
#### Returns
`void`
___
### ecommerceCartUpdate
▸ **ecommerceCartUpdate**(`products`, `grandTotal`): `void`
Tracks current state of a cart
#### Parameters
| Name | Type |
| :------ | :------ |
| `products` | [`Product`](#product)[] |
| `grandTotal` | `string` \| `number` |
#### Returns
`void`
___
### ecommerceOrder
▸ **ecommerceOrder**(`products`, `paymentInformation`): `void`
Tracks conversion, including products and payment details
#### Parameters
| Name | Type |
| :------ | :------ |
| `products` | [`Product`](#product)[] |
| `paymentInformation` | [`PaymentInformation`](#paymentinformation) |
#### Returns
`void`
___
### ecommerceProductDetailView
▸ **ecommerceProductDetailView**(`products`): `void`
Tracks action of viewing product page
#### Parameters
| Name | Type |
| :------ | :------ |
| `products` | [`Product`](#product)[] |
#### Returns
`void`
___
### ecommerceRemoveFromCart
▸ **ecommerceRemoveFromCart**(`products`): `void`
Tracks action of removing a products from a cart
#### Parameters
| Name | Type |
| :------ | :------ |
| `products` | [`Product`](#product)[] |
#### Returns
`void`
___
### getEcommerceItems
▸ **getEcommerceItems**(): `Promise`\<`object`\>
#### Returns
`Promise`\<`object`\>
**`Deprecated`**
___
### removeEcommerceItem
▸ **removeEcommerceItem**(`productSKU`): `void`
#### Parameters
| Name | Type |
| :------ | :------ |
| `productSKU` | `string` |
#### Returns
`void`
**`Deprecated`**
Please use the ecommerceRemoveFromCart instead.
___
### setEcommerceView
▸ **setEcommerceView**(`productSKU`, `productName?`, `productCategory?`, `productPrice?`): `void`
#### Parameters
| Name | Type |
| :------ | :------ |
| `productSKU` | `string` |
| `productName?` | `string` |
| `productCategory?` | `string`[] |
| `productPrice?` | `string` |
#### Returns
`void`
**`Deprecated`**
___
### trackEcommerceCartUpdate
▸ **trackEcommerceCartUpdate**(`cartAmount`): `void`
#### Parameters
| Name | Type |
| :------ | :------ |
| `cartAmount` | `number` |
#### Returns
`void`
**`Deprecated`**
Please use the ecommerceCartUpdate instead.
___
### trackEcommerceOrder
▸ **trackEcommerceOrder**(`orderId`, `orderGrandTotal`, `orderSubTotal?`, `orderTax?`, `orderShipping?`, `orderDiscount?`): `void`
#### Parameters
| Name | Type |
| :------ | :------ |
| `orderId` | `string` |
| `orderGrandTotal` | `number` |
| `orderSubTotal?` | `number` |
| `orderTax?` | `number` |
| `orderShipping?` | `number` |
| `orderDiscount?` | `number` |
#### Returns
`void`
**`Deprecated`**
Please use the ecommerceOrder instead.

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