Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rw-r--r--js/piwik.js12
1 files changed, 10 insertions, 2 deletions
diff --git a/js/piwik.js b/js/piwik.js
index bed97aa65f..1079b7c859 100644
--- a/js/piwik.js
+++ b/js/piwik.js
@@ -3970,9 +3970,10 @@ if (typeof window.Piwik !== 'object') {
lastEcommerceOrderTs,
now = new Date(),
items = [],
- sku;
+ sku,
+ isEcommerceOrder = String(orderId).length;
- if (String(orderId).length) {
+ if (isEcommerceOrder) {
request += '&ec_id=' + encodeWrapper(orderId);
// Record date of order in the visitor cookie
lastEcommerceOrderTs = Math.round(now.getTime() / 1000);
@@ -4028,6 +4029,10 @@ if (typeof window.Piwik !== 'object') {
}
request = getRequest(request, configCustomData, 'ecommerce', lastEcommerceOrderTs);
sendRequest(request, configTrackerPause);
+
+ if (isEcommerceOrder) {
+ ecommerceItems = {};
+ }
}
function logEcommerceOrder(orderId, grandTotal, subTotal, tax, shipping, discount) {
@@ -6320,6 +6325,7 @@ if (typeof window.Piwik !== 'object') {
* Adds an item (product) that is in the current Cart or in the Ecommerce order.
* This function is called for every item (product) in the Cart or the Order.
* The only required parameter is sku.
+ * The items are deleted from this JavaScript object when the Ecommerce order is tracked via the method trackEcommerceOrder.
*
* @param string sku (required) Item's SKU Code. This is the unique identifier for the product.
* @param string name (optional) Item's name
@@ -6338,6 +6344,7 @@ if (typeof window.Piwik !== 'object') {
* If the Ecommerce order contains items (products), you must call first the addEcommerceItem() for each item in the order.
* All revenues (grandTotal, subTotal, tax, shipping, discount) will be individually summed and reported in Piwik reports.
* Parameters orderId and grandTotal are required. For others, you can set to false if you don't need to specify them.
+ * After calling this method, items added to the cart will be removed from this JavaScript object.
*
* @param string|int orderId (required) Unique Order ID.
* This will be used to count this order only once in the event the order page is reloaded several times.
@@ -6356,6 +6363,7 @@ if (typeof window.Piwik !== 'object') {
* Tracks a Cart Update (add item, remove item, update item).
* On every Cart update, you must call addEcommerceItem() for each item (product) in the cart, including the items that haven't been updated since the last cart update.
* Then you can call this function with the Cart grandTotal (typically the sum of all items' prices)
+ * Calling this method does not remove from this JavaScript object the items that were added to the cart via addEcommerceItem
*
* @param float grandTotal (required) Items (products) amount in the Cart
*/