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:
authorThomas Steur <tsteur@users.noreply.github.com>2016-10-01 01:56:01 +0300
committerMatthieu Aubry <mattab@users.noreply.github.com>2016-10-01 01:56:01 +0300
commit65bc19b4dca9cd951c36bb5de39231aed2df85dd (patch)
tree9af9e9fed2d6998251a1b568369e58ac304da043 /tests/javascript
parent40f535174a305aa19d37e6367dca2bfc8eb1c4c8 (diff)
Track a unique id for each pageview (#10499)
* track a unique id for each pageview * fix tests * reduce idpageview to 6 bytes * added changelog entry
Diffstat (limited to 'tests/javascript')
-rw-r--r--tests/javascript/index.php11
1 files changed, 10 insertions, 1 deletions
diff --git a/tests/javascript/index.php b/tests/javascript/index.php
index c03d06ba22..34a8d252f5 100644
--- a/tests/javascript/index.php
+++ b/tests/javascript/index.php
@@ -3187,7 +3187,7 @@ if ($mysql) {
});
test("tracking", function() {
- expect(119);
+ expect(124);
// Prevent Opera and HtmlUnit from performing the default action (i.e., load the href URL)
var stopEvent = function (evt) {
@@ -3266,11 +3266,18 @@ if ($mysql) {
referrerTimestamp = Math.round(new Date().getTime() / 1000);
tracker.trackPageView();
+ var idPageview = tracker.getConfigIdPageView();
+ ok(/([0-9a-zA-Z]){6}/.test(idPageview), 'trackPageview, should generate a random pageview id');
+
equal(tracker.getCustomDimension(1), "my custom value", "custom dimensions should not be cleared after a tracked pageview");
equal(tracker.getCustomDimension(2), "", "custom dimensions should not be cleared after a tracked pageview");
tracker.trackPageView("CustomTitleTest", {dimension2: 'my new value', dimension5: 'another dimension'});
+ var idPageviewCustomTitle = tracker.getConfigIdPageView();
+ ok(idPageviewCustomTitle != idPageview, 'trackPageview, should generate a new random pageview id whenever it is called');
+ ok(/([0-9a-zA-Z]){6}/.test(idPageviewCustomTitle), 'trackPageview, new generated random pageview id should be 16 char a-Z0-9 as well');
+
var customUrlShouldNotChangeCampaign = "http://localhost.localdomain/?utm_campaign=NONONONONONONO&utm_term=PLEASE NO!";
tracker.setCustomUrl(customUrl);
@@ -3523,6 +3530,8 @@ if ($mysql) {
ok( results.indexOf("tests/javascript/piwik.php?action_name=Asynchronous%20Tracker%20ONE&idsite=1&rec=1") >= 0 , "async trackPageView() called before setTrackerUrl() should work" );
ok( /Asynchronous%20tracking%20TWO/.test( results ), "async trackPageView() called after another trackPageView()" );
ok( /CustomTitleTest/.test( results ), "trackPageView(customTitle)" );
+ ok( results.indexOf('&pv_id=' + idPageview) !== -1, "trackPageView, configPageId should be sent along requests" );
+ ok( results.indexOf('&pv_id=' + idPageviewCustomTitle) !== -1, "trackPageView, idPageviewCustomTitle should be sent along requests when a new is generated" );
ok( ! /click.example.com/.test( results ), "click: ignore href=javascript" );
ok( /example.ca/.test( results ), "trackLink()" );
ok( /example.fr/.test( results ), "async trackLink()" );