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

@piwikpro/react-piwik-pro

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

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

Comparing version 1.2.1 to 1.3.1

dist/interfaces/payment.d.ts

11

dist/constants/track-event.constant.d.ts

@@ -6,8 +6,7 @@ export declare enum TRACK_EVENT {

SEARCH = "trackSiteSearch",
ADD_ECOMMERCE_ITEM = "addEcommerceItem",
REMOVE_ECOMMERCE_ITEM = "removeEcommerceItem",
CLEAR_ECOMMERCE_CART = "clearEcommerceCart",
SET_ECOMMERCE_VIEW = "setEcommerceView",
UPDATE_ECOMMERCE_CART = "trackEcommerceCartUpdate",
ORDER_ECOMMERCE = "trackEcommerceOrder",
ADD_ECOMMERCE_ITEM = "ecommerceAddToCart",
REMOVE_ECOMMERCE_ITEM = "ecommerceAddToCart",
ECOMMERCE_PRODUCT_DETAIL_VIEW = "ecommerceProductDetailView",
UPDATE_ECOMMERCE_CART = "ecommerceCartUpdate",
ORDER_ECOMMERCE = "ecommerceOrder",
SET_CUSTOM_VARIABLE = "setCustomVariable",

@@ -14,0 +13,0 @@ DELETE_CUSTOM_VARIABLE = "deleteCustomVariable",

@@ -20,6 +20,6 @@ function init(containerId, containerUrl, nonce) {

if (nonce) {
s.setAttribute("nonce", nonce);
s.setAttribute('nonce', nonce);
}
s.text = "(function(window, document, dataLayerName, id) {\nwindow[dataLayerName]=window[dataLayerName]||[],window[dataLayerName].push({start:(new Date).getTime(),event:\"stg.start\"});var scripts=document.getElementsByTagName('script')[0],tags=document.createElement('script');\nfunction 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()}document.cookie=a+\"=\"+b+d+\"; path=/\"}\nvar 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);\nvar qP=[];dataLayerName!==\"dataLayer\"&&qP.push(\"data_layer_name=\"+dataLayerName),isStgDebug&&qP.push(\"stg_debug\");var qPString=qP.length>0?(\"?\"+qP.join(\"&\")):\"\";\ntags.async=!0,tags.src=\"" + containerUrl + "/containers/\"+id+\".js\"+qPString,scripts.parentNode.insertBefore(tags,scripts);\n!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\"]);\n})(window, document, 'dataLayer', '" + containerId + "')";
s.text = "(function(window, document, dataLayerName, id) {\nwindow[dataLayerName]=window[dataLayerName]||[],window[dataLayerName].push({start:(new Date).getTime(),event:\"stg.start\"});var scripts=document.getElementsByTagName('script')[0],tags=document.createElement('script');\nfunction 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=/\"}\nvar 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);\nvar qP=[];dataLayerName!==\"dataLayer\"&&qP.push(\"data_layer_name=\"+dataLayerName),isStgDebug&&qP.push(\"stg_debug\");var qPString=qP.length>0?(\"?\"+qP.join(\"&\")):\"\";\ntags.async=!0,tags.src=\"" + containerUrl + "/\"+id+\".js\"+qPString,scripts.parentNode.insertBefore(tags,scripts);\n!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\"]);\n})(window, document, 'dataLayer', '" + containerId + "')";
var head = document.getElementsByTagName('body')[0];

@@ -41,8 +41,7 @@ head.appendChild(s);

TRACK_EVENT["SEARCH"] = "trackSiteSearch";
TRACK_EVENT["ADD_ECOMMERCE_ITEM"] = "addEcommerceItem";
TRACK_EVENT["REMOVE_ECOMMERCE_ITEM"] = "removeEcommerceItem";
TRACK_EVENT["CLEAR_ECOMMERCE_CART"] = "clearEcommerceCart";
TRACK_EVENT["SET_ECOMMERCE_VIEW"] = "setEcommerceView";
TRACK_EVENT["UPDATE_ECOMMERCE_CART"] = "trackEcommerceCartUpdate";
TRACK_EVENT["ORDER_ECOMMERCE"] = "trackEcommerceOrder";
TRACK_EVENT["ADD_ECOMMERCE_ITEM"] = "ecommerceAddToCart";
TRACK_EVENT["REMOVE_ECOMMERCE_ITEM"] = "ecommerceAddToCart";
TRACK_EVENT["ECOMMERCE_PRODUCT_DETAIL_VIEW"] = "ecommerceProductDetailView";
TRACK_EVENT["UPDATE_ECOMMERCE_CART"] = "ecommerceCartUpdate";
TRACK_EVENT["ORDER_ECOMMERCE"] = "ecommerceOrder";
TRACK_EVENT["SET_CUSTOM_VARIABLE"] = "setCustomVariable";

@@ -320,11 +319,8 @@ TRACK_EVENT["DELETE_CUSTOM_VARIABLE"] = "deleteCustomVariable";

function addEcommerceItem(productSKU, productName, productCategory, productPrice, productQuantity) {
PaqService.push([TRACK_EVENT.ADD_ECOMMERCE_ITEM, productSKU, productName, productCategory, productPrice, productQuantity]);
function addEcommerceItem(products) {
PaqService.push([TRACK_EVENT.ADD_ECOMMERCE_ITEM, products]);
}
function removeEcommerceItem(productSKU) {
PaqService.push([TRACK_EVENT.REMOVE_ECOMMERCE_ITEM, productSKU]);
function removeEcommerceItem(products) {
PaqService.push([TRACK_EVENT.REMOVE_ECOMMERCE_ITEM, products]);
}
function clearEcommerceCart() {
PaqService.push([TRACK_EVENT.CLEAR_ECOMMERCE_CART]);
}
function getEcommerceItems() {

@@ -343,10 +339,10 @@ return new Promise(function (resolve, reject) {

}
function trackEcommerceOrder(orderId, orderGrandTotal, orderSubTotal, orderTax, orderShipping, orderDiscount) {
PaqService.push([TRACK_EVENT.ORDER_ECOMMERCE, orderId, orderGrandTotal, orderSubTotal, orderTax, orderShipping, orderDiscount]);
function ecommerceOrder(products, paymentInformation) {
PaqService.push([TRACK_EVENT.ORDER_ECOMMERCE, products, paymentInformation]);
}
function trackEcommerceCartUpdate(cartAmount) {
PaqService.push([TRACK_EVENT.UPDATE_ECOMMERCE_CART, cartAmount]);
function updateEcommerceCart(products, grandTotal) {
PaqService.push([TRACK_EVENT.UPDATE_ECOMMERCE_CART, products, grandTotal]);
}
function setEcommerceView(productSKU, productName, productCategory, productPrice) {
PaqService.push([TRACK_EVENT.SET_ECOMMERCE_VIEW, productSKU, productName, productCategory, productPrice]);
function ecommerceProductDetailView(products) {
PaqService.push([TRACK_EVENT.ECOMMERCE_PRODUCT_DETAIL_VIEW, products]);
}

@@ -358,7 +354,6 @@

removeEcommerceItem: removeEcommerceItem,
clearEcommerceCart: clearEcommerceCart,
getEcommerceItems: getEcommerceItems,
trackEcommerceOrder: trackEcommerceOrder,
trackEcommerceCartUpdate: trackEcommerceCartUpdate,
setEcommerceView: setEcommerceView
ecommerceOrder: ecommerceOrder,
updateEcommerceCart: updateEcommerceCart,
ecommerceProductDetailView: ecommerceProductDetailView
};

@@ -365,0 +360,0 @@

@@ -20,6 +20,6 @@ function init(containerId, containerUrl, nonce) {

if (nonce) {
s.setAttribute("nonce", nonce);
s.setAttribute('nonce', nonce);
}
s.text = "(function(window, document, dataLayerName, id) {\nwindow[dataLayerName]=window[dataLayerName]||[],window[dataLayerName].push({start:(new Date).getTime(),event:\"stg.start\"});var scripts=document.getElementsByTagName('script')[0],tags=document.createElement('script');\nfunction 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()}document.cookie=a+\"=\"+b+d+\"; path=/\"}\nvar 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);\nvar qP=[];dataLayerName!==\"dataLayer\"&&qP.push(\"data_layer_name=\"+dataLayerName),isStgDebug&&qP.push(\"stg_debug\");var qPString=qP.length>0?(\"?\"+qP.join(\"&\")):\"\";\ntags.async=!0,tags.src=\"" + containerUrl + "/containers/\"+id+\".js\"+qPString,scripts.parentNode.insertBefore(tags,scripts);\n!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\"]);\n})(window, document, 'dataLayer', '" + containerId + "')";
s.text = "(function(window, document, dataLayerName, id) {\nwindow[dataLayerName]=window[dataLayerName]||[],window[dataLayerName].push({start:(new Date).getTime(),event:\"stg.start\"});var scripts=document.getElementsByTagName('script')[0],tags=document.createElement('script');\nfunction 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=/\"}\nvar 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);\nvar qP=[];dataLayerName!==\"dataLayer\"&&qP.push(\"data_layer_name=\"+dataLayerName),isStgDebug&&qP.push(\"stg_debug\");var qPString=qP.length>0?(\"?\"+qP.join(\"&\")):\"\";\ntags.async=!0,tags.src=\"" + containerUrl + "/\"+id+\".js\"+qPString,scripts.parentNode.insertBefore(tags,scripts);\n!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\"]);\n})(window, document, 'dataLayer', '" + containerId + "')";
var head = document.getElementsByTagName('body')[0];

@@ -41,8 +41,7 @@ head.appendChild(s);

TRACK_EVENT["SEARCH"] = "trackSiteSearch";
TRACK_EVENT["ADD_ECOMMERCE_ITEM"] = "addEcommerceItem";
TRACK_EVENT["REMOVE_ECOMMERCE_ITEM"] = "removeEcommerceItem";
TRACK_EVENT["CLEAR_ECOMMERCE_CART"] = "clearEcommerceCart";
TRACK_EVENT["SET_ECOMMERCE_VIEW"] = "setEcommerceView";
TRACK_EVENT["UPDATE_ECOMMERCE_CART"] = "trackEcommerceCartUpdate";
TRACK_EVENT["ORDER_ECOMMERCE"] = "trackEcommerceOrder";
TRACK_EVENT["ADD_ECOMMERCE_ITEM"] = "ecommerceAddToCart";
TRACK_EVENT["REMOVE_ECOMMERCE_ITEM"] = "ecommerceAddToCart";
TRACK_EVENT["ECOMMERCE_PRODUCT_DETAIL_VIEW"] = "ecommerceProductDetailView";
TRACK_EVENT["UPDATE_ECOMMERCE_CART"] = "ecommerceCartUpdate";
TRACK_EVENT["ORDER_ECOMMERCE"] = "ecommerceOrder";
TRACK_EVENT["SET_CUSTOM_VARIABLE"] = "setCustomVariable";

@@ -320,11 +319,8 @@ TRACK_EVENT["DELETE_CUSTOM_VARIABLE"] = "deleteCustomVariable";

function addEcommerceItem(productSKU, productName, productCategory, productPrice, productQuantity) {
PaqService.push([TRACK_EVENT.ADD_ECOMMERCE_ITEM, productSKU, productName, productCategory, productPrice, productQuantity]);
function addEcommerceItem(products) {
PaqService.push([TRACK_EVENT.ADD_ECOMMERCE_ITEM, products]);
}
function removeEcommerceItem(productSKU) {
PaqService.push([TRACK_EVENT.REMOVE_ECOMMERCE_ITEM, productSKU]);
function removeEcommerceItem(products) {
PaqService.push([TRACK_EVENT.REMOVE_ECOMMERCE_ITEM, products]);
}
function clearEcommerceCart() {
PaqService.push([TRACK_EVENT.CLEAR_ECOMMERCE_CART]);
}
function getEcommerceItems() {

@@ -343,10 +339,10 @@ return new Promise(function (resolve, reject) {

}
function trackEcommerceOrder(orderId, orderGrandTotal, orderSubTotal, orderTax, orderShipping, orderDiscount) {
PaqService.push([TRACK_EVENT.ORDER_ECOMMERCE, orderId, orderGrandTotal, orderSubTotal, orderTax, orderShipping, orderDiscount]);
function ecommerceOrder(products, paymentInformation) {
PaqService.push([TRACK_EVENT.ORDER_ECOMMERCE, products, paymentInformation]);
}
function trackEcommerceCartUpdate(cartAmount) {
PaqService.push([TRACK_EVENT.UPDATE_ECOMMERCE_CART, cartAmount]);
function updateEcommerceCart(products, grandTotal) {
PaqService.push([TRACK_EVENT.UPDATE_ECOMMERCE_CART, products, grandTotal]);
}
function setEcommerceView(productSKU, productName, productCategory, productPrice) {
PaqService.push([TRACK_EVENT.SET_ECOMMERCE_VIEW, productSKU, productName, productCategory, productPrice]);
function ecommerceProductDetailView(products) {
PaqService.push([TRACK_EVENT.ECOMMERCE_PRODUCT_DETAIL_VIEW, products]);
}

@@ -358,7 +354,6 @@

removeEcommerceItem: removeEcommerceItem,
clearEcommerceCart: clearEcommerceCart,
getEcommerceItems: getEcommerceItems,
trackEcommerceOrder: trackEcommerceOrder,
trackEcommerceCartUpdate: trackEcommerceCartUpdate,
setEcommerceView: setEcommerceView
ecommerceOrder: ecommerceOrder,
updateEcommerceCart: updateEcommerceCart,
ecommerceProductDetailView: ecommerceProductDetailView
};

@@ -365,0 +360,0 @@

@@ -1,7 +0,8 @@

export declare function addEcommerceItem(productSKU: string, productName: string, productCategory: string | string[], productPrice: number, productQuantity: number): void;
export declare function removeEcommerceItem(productSKU: string): void;
export declare function clearEcommerceCart(): void;
import { Product } from '../../interfaces/product';
import { PaymentInformation } from '../../interfaces/payment';
export declare function addEcommerceItem(products: Product[]): void;
export declare function removeEcommerceItem(products: Product[]): void;
export declare function getEcommerceItems(): Promise<object>;
export declare function trackEcommerceOrder(orderId: string, orderGrandTotal: number, orderSubTotal?: number, orderTax?: number, orderShipping?: number, orderDiscount?: number): void;
export declare function trackEcommerceCartUpdate(cartAmount: number): void;
export declare function setEcommerceView(productSKU: string, productName?: string, productCategory?: string[], productPrice?: string): void;
export declare function ecommerceOrder(products: Product[], paymentInformation: PaymentInformation): void;
export declare function updateEcommerceCart(products: Product[], grandTotal: PaymentInformation['grandTotal']): void;
export declare function ecommerceProductDetailView(products: Product[]): void;
{
"name": "@piwikpro/react-piwik-pro",
"version": "1.2.1",
"version": "1.3.1",
"description": "Piwik PRO tracking library for ReactJS",

@@ -27,35 +27,35 @@ "author": "Piwik Pro Integration Team <integrations@piwik.pro>",

"peerDependencies": {
"react": "^16.0.0 || ^17.0.0 || ^18.0.0"
"react": ">=18.0.0 <19.0.0",
"react-dom": ">=18.0.0 <19.0.0"
},
"devDependencies": {
"@babel/plugin-proposal-unicode-property-regex": "^7.18.6",
"@testing-library/jest-dom": "^6.1.3",
"@testing-library/react": "^14.0.0",
"@testing-library/user-event": "^14.5.1",
"@types/jest": "^29.5.5",
"@types/node": "^20.6.3",
"@types/react": "^18.2.22",
"@types/react-dom": "^18.2.7",
"@typescript-eslint/eslint-plugin": "^6.7.2",
"@typescript-eslint/parser": "^6.7.2",
"@testing-library/jest-dom": "^6.2.0",
"@testing-library/react": "^14.1.2",
"@testing-library/user-event": "^14.5.2",
"@types/jest": "^29.5.11",
"@types/node": "^20.10.7",
"@types/react": "^18.2.47",
"@types/react-dom": "^18.2.18",
"@typescript-eslint/eslint-plugin": "^6.18.0",
"@typescript-eslint/parser": "^6.18.0",
"babel-eslint": "^10.1.0",
"cross-env": "^7.0.3",
"eslint": "^8.50.0",
"eslint-config-prettier": "^9.0.0",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"eslint-config-standard": "^17.1.0",
"eslint-config-standard-react": "^13.0.0",
"eslint-plugin-import": "^2.28.1",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^5.0.0",
"eslint-plugin-prettier": "^5.1.2",
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-standard": "^5.0.0",
"gh-pages": "^6.0.0",
"gh-pages": "^6.1.1",
"microbundle-crl": "^0.13.11",
"npm-run-all": "^4.1.5",
"prettier": "^3.0.3",
"prettier": "^3.1.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-scripts": "^5.0.1",
"typescript": "^5.2.2"
"typescript": "^5.3.3"
},

@@ -62,0 +62,0 @@ "files": [

@@ -210,9 +210,8 @@ # Piwik PRO Library for React

#### Methods
* `addEcommerceItem(productSKU: string, productName: string, productCategory: string | string[], productPrice: number, productQuantity: number)` - Adds a product to a virtual shopping cart. If a product with the same SKU is in the cart, it will be removed first. Does not send any data to the Collecting & Processing Pipeline.
* `removeEcommerceItem(productSKU: string)` - Removes a product with the provided SKU from a virtual shopping cart. If multiple units of that product are in the virtual cart, all of them will be removed. Does not send any data to the Collecting & Processing Pipeline.
* `clearEcommerceCart()` - Removes all items from a virtual shopping cart. Does not send any data to the Collecting & Processing Pipeline.
* `addEcommerceItem(products: Product[])` - Tracks action of adding products to a cart.
* `removeEcommerceItem(products: Product[])` - Tracks action of removing a product from a cart.
* `getEcommerceItems()` - Returns a copy of items from a virtual shopping cart. Does not send any data to the Collecting & Processing Pipeline
* `trackEcommerceOrder()` - Tracks a successfully placed e-commerce order with items present in a virtual cart (registered using addEcommerceItem).
* `trackEcommerceCartUpdate(cartAmount: number)` - Tracks items present in a virtual shopping cart (registered with addEcommerceItem)
* `setEcommerceView(productSKU: string, productName?: string, productCategory?: string[], productPrice?: string)` - Tracks product or category view. Must be followed by a page view.
* `ecommerceOrder(products: Product[], paymentInformation: PaymentInformation)` - Tracks conversion (including products and payment details).
* `updateEcommerceCart(products: Product[], grandTotal: PaymentInformation['grandTotal'])` - Tracks current state of a cart.
* `ecommerceProductDetailView(products: Product[])` - Tracks product or category view. Must be followed by a page view.

@@ -219,0 +218,0 @@ ### Content Tracking Service

Sorry, the diff of this file is not supported yet

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