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
diff options
context:
space:
mode:
authorMatthieu Aubry <mattab@users.noreply.github.com>2016-07-12 11:39:19 +0300
committerGitHub <noreply@github.com>2016-07-12 11:39:19 +0300
commitfcea45140745d8218b78001490ddf0fa755e6467 (patch)
tree936dc48eaaed02d31f0eee9a6afe664d89e9be4c /tests/javascript
parent713806da44a4bb4e9c6d3779188c83d78c8eb9b5 (diff)
Reset the list of items in the cart, after tracking an ecommerce conversion (#10279)
* Clarify that token_auth must be an admin or super user token. * Reset the list of items in the cart, after tracking an ecommerce conversion But do not reset the list of itms in the cart after tracking an ecommerce cart update. fixes #10252 * Adding changelog note `piwik.js`: after an ecommerce order is tracked using `trackEcommerceOrder`, the items in the cart will now be removed from the JavaScript object. Calling `trackEcommerceCartUpdate` will not remove the items in the cart.
Diffstat (limited to 'tests/javascript')
-rw-r--r--tests/javascript/index.php11
1 files changed, 9 insertions, 2 deletions
diff --git a/tests/javascript/index.php b/tests/javascript/index.php
index f796b93cf3..bd592f7cf1 100644
--- a/tests/javascript/index.php
+++ b/tests/javascript/index.php
@@ -3033,7 +3033,7 @@ if ($mysql) {
});
test("tracking", function() {
- expect(117);
+ expect(118);
// Prevent Opera and HtmlUnit from performing the default action (i.e., load the href URL)
var stopEvent = function (evt) {
@@ -3287,8 +3287,12 @@ if ($mysql) {
tracker3.addEcommerceItem("SKU NO PRICE NO QUANTITY", "PRODUCT NAME 3", "CATEGORY", "", "" );
tracker3.addEcommerceItem("SKU ONLY" );
tracker3.trackEcommerceCartUpdate( 555.55 );
+
tracker3.trackEcommerceOrder( "ORDER ID YES", 666.66, 333, 222, 111, 1 );
+ // the same order tracked once more, should have no items
+ tracker3.trackEcommerceOrder( "ORDER WITHOUT ANY ITEM", 777, 444, 222, 111, 1 );
+
// do not track
tracker3.setDoNotTrack(false);
@@ -3351,7 +3355,7 @@ if ($mysql) {
xhr.open("GET", "piwik.php?requests=" + getToken(), false);
xhr.send(null);
results = xhr.responseText;
- equal( (/<span\>([0-9]+)\<\/span\>/.exec(results))[1], "35", "count tracking events" );
+ equal( (/<span\>([0-9]+)\<\/span\>/.exec(results))[1], "36", "count tracking events" );
// firing callback
ok( trackLinkCallbackFired, "trackLink() callback fired" );
@@ -3428,6 +3432,9 @@ if ($mysql) {
// Cart update
ok( /idgoal=0&revenue=555.55&ec_items=%5B%5B%22SKU%20PRODUCT%22%2C%22random%22%2C%22random%20PRODUCT%20CATEGORY%22%2C11.1111%2C2%5D%2C%5B%22SKU%20ONLY%20SKU%22%2C%22%22%2C%22%22%2C0%2C1%5D%2C%5B%22SKU%20ONLY%20NAME%22%2C%22PRODUCT%20NAME%202%22%2C%22%22%2C0%2C1%5D%2C%5B%22SKU%20NO%20PRICE%20NO%20QUANTITY%22%2C%22PRODUCT%20NAME%203%22%2C%22CATEGORY%22%2C0%2C1%5D%2C%5B%22SKU%20ONLY%22%2C%22%22%2C%22%22%2C0%2C1%5D%5D/.test( results ), "logEcommerceCartUpdate() with items" );
+ // Ecommerce order recorded twice, but each order empties the cart/list of items, so this order is empty of items
+ ok( /idgoal=0&ec_id=ORDER%20WITHOUT%20ANY%20ITEM&revenue=777&ec_st=444&ec_tx=222&ec_sh=111&ec_dt=1&ec_items=%5B%5D/.test( results ), "logEcommerceOrder() called twice, second time has no item" );
+
// parameters inserted by plugin hooks
ok( /testlog/.test( results ), "plugin hook log" );
ok( /testlink/.test( results ), "plugin hook link" );