From 73010596f01b9660899267305fe0cf5064428753 Mon Sep 17 00:00:00 2001 From: Thomas Steur Date: Thu, 29 Nov 2018 20:22:15 +1300 Subject: Make matomo.js and matomo.php the default Tracking API endpoints used (#13596) * Make matomo.js and matomo.php the default Tracking API endpoints used * few fixes * fix few tests * update matomo php tracker in composer * make sure to record install version * do not overwrite ever install version * trying to fix test * more tweaks and fix tests * prefer matomo endpoint in the ui, fix some tests * file was still needed * apply review feedback * fix ui tests --- tests/javascript/index.php | 118 ++++++++++++++++++++++----------------------- 1 file changed, 59 insertions(+), 59 deletions(-) (limited to 'tests/javascript/index.php') diff --git a/tests/javascript/index.php b/tests/javascript/index.php index f7670f71cf..287e781cc9 100644 --- a/tests/javascript/index.php +++ b/tests/javascript/index.php @@ -3,7 +3,7 @@ - piwik.js: Unit Tests + matomo.js: Unit Tests - + @@ -274,7 +274,7 @@ function triggerEvent(element, type, buttonNumber) { window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : null; - xhr.open("GET", "piwik.php?requests=" + token, false); + xhr.open("GET", "matomo.php?requests=" + token, false); xhr.send(null); var response = xhr.responseText; @@ -1846,31 +1846,31 @@ function PiwikTest() { strictEqual(actual, undefined, 'nothing set'); actual = tracker.buildContentInteractionTrackingRedirectUrl('/path?a=b'); - assertTrackingRequest(actual, 'piwik.php?redirecturl=' + encodeWrapper(origin + '/path?a=b') + '&c_t=%2Fpath%3Fa%3Db', + assertTrackingRequest(actual, 'matomo.php?redirecturl=' + encodeWrapper(origin + '/path?a=b') + '&c_t=%2Fpath%3Fa%3Db', 'should build redirect url including domain when absolute path. Target should also fallback to passed url if not set'); actual = tracker.buildContentInteractionTrackingRedirectUrl('path?a=b'); - assertTrackingRequest(actual, 'piwik.php?redirecturl=' + toEncodedAbsoluteUrl('path?a=b') + '&c_t=path%3Fa%3Db', + assertTrackingRequest(actual, 'matomo.php?redirecturl=' + toEncodedAbsoluteUrl('path?a=b') + '&c_t=path%3Fa%3Db', 'should build redirect url including domain when relative path. Target should also fallback to passed url if not set'); actual = tracker.buildContentInteractionTrackingRedirectUrl('#test', 'click', 'name', 'piece', 'target'); - assertTrackingRequest(actual, 'piwik.php?redirecturl=' + toEncodedAbsoluteUrl('#test') + '&c_i=click&c_n=name&c_p=piece&c_t=target', 'all params set'); + assertTrackingRequest(actual, 'matomo.php?redirecturl=' + toEncodedAbsoluteUrl('#test') + '&c_i=click&c_n=name&c_p=piece&c_t=target', 'all params set'); trackerUrl = tracker.getTrackerUrl(); - tracker.setTrackerUrl('piwik.php?test=1'); + tracker.setTrackerUrl('matomo.php?test=1'); actual = tracker.buildContentInteractionTrackingRedirectUrl('#test', 'click', 'name', 'piece', 'target'); - assertTrackingRequest(actual, 'piwik.php?test=1&redirecturl=' + toEncodedAbsoluteUrl('#test') + '&c_i=click&c_n=name&c_p=piece&c_t=target', 'should use & if tracker url already contains question mark'); + assertTrackingRequest(actual, 'matomo.php?test=1&redirecturl=' + toEncodedAbsoluteUrl('#test') + '&c_i=click&c_n=name&c_p=piece&c_t=target', 'should use & if tracker url already contains question mark'); - tracker.setTrackerUrl('piwik.php'); - actual = tracker.buildContentInteractionTrackingRedirectUrl('piwik.php?redirecturl=http://www.example.com', 'click', 'name', 'piece', 'target'); - strictEqual(actual, 'piwik.php?redirecturl=http://www.example.com', 'should return unmodified url if it is already a tracker url so users can set piwik.php link in href'); + tracker.setTrackerUrl('matomo.php'); + actual = tracker.buildContentInteractionTrackingRedirectUrl('matomo.php?redirecturl=http://www.example.com', 'click', 'name', 'piece', 'target'); + strictEqual(actual, 'matomo.php?redirecturl=http://www.example.com', 'should return unmodified url if it is already a tracker url so users can set matomo.php link in href'); actual = tracker.buildContentInteractionTrackingRedirectUrl('http://www.example.com', 'click', 'name'); - assertTrackingRequest(actual, 'piwik.php?redirecturl=' + encodeWrapper('http://www.example.com') + '&c_i=click&c_n=name&c_t=http%3A%2F%2Fwww.example.com', 'should not change url if absolute'); + assertTrackingRequest(actual, 'matomo.php?redirecturl=' + encodeWrapper('http://www.example.com') + '&c_i=click&c_n=name&c_t=http%3A%2F%2Fwww.example.com', 'should not change url if absolute'); actual = tracker.buildContentInteractionTrackingRedirectUrl(origin, 'something', 'name', undefined, 'target'); - assertTrackingRequest(actual, 'piwik.php?redirecturl=' + originEncoded + '&c_i=something&c_n=name&c_t=target', 'should not change url if same domain'); + assertTrackingRequest(actual, 'matomo.php?redirecturl=' + originEncoded + '&c_i=something&c_n=name&c_t=target', 'should not change url if same domain'); tracker.setTrackerUrl(trackerUrl); @@ -1938,7 +1938,7 @@ function PiwikTest() { ok('test trackContentImpressionClickInteraction()'); trackerUrl = tracker.getTrackerUrl(); - tracker.setTrackerUrl('piwik.php'); + tracker.setTrackerUrl('matomo.php'); tracker.disableLinkTracking(); ok(_s('#ignoreInteraction1') && _s('#ex108') && _s('#ex109'), 'make sure node exists otherwise test is useless'); @@ -1951,15 +1951,15 @@ function PiwikTest() { assertTrackingRequest(actual, 'c_i=click&c_n=http%3A%2F%2Fwww.example.com%2Fpath%2Fxyz.jpg&c_p=http%3A%2F%2Fwww.example.com%2Fpath%2Fxyz.jpg&c_t=http%3A%2F%2Fad.example.com', 'trackContentImpressionClickInteraction, is outlink but should use xhr as link tracking not enabled'); actual = (tracker.trackContentImpressionClickInteraction(_s('#ex109')))({target: _s('#ex109')}); strictEqual(actual, 'href', 'trackContentImpressionClickInteraction, is internal download but should use href as link tracking not enabled'); - assertTrackingRequest($(_s('#ex109')).attr('href'), 'piwik.php?redirecturl=' + toEncodedAbsoluteUrl('/file.pdf') + '&c_i=click&c_n=http%3A%2F%2Fwww.example.com%2Fpath%2Fxyz.jpg&c_p=http%3A%2F%2Fwww.example.com%2Fpath%2Fxyz.jpg&c_t=' + originEncoded + '%2Ffile.pdf', 'trackContentImpressionClickInteraction, the href download link should be replaced with a redirect link to tracker'); + assertTrackingRequest($(_s('#ex109')).attr('href'), 'matomo.php?redirecturl=' + toEncodedAbsoluteUrl('/file.pdf') + '&c_i=click&c_n=http%3A%2F%2Fwww.example.com%2Fpath%2Fxyz.jpg&c_p=http%3A%2F%2Fwww.example.com%2Fpath%2Fxyz.jpg&c_t=' + originEncoded + '%2Ffile.pdf', 'trackContentImpressionClickInteraction, the href download link should be replaced with a redirect link to tracker'); actual = (tracker.trackContentImpressionClickInteraction(_s('#ex110')))({target: _s('#ex110')}); strictEqual(actual, 'href', 'trackContentImpressionClickInteraction, should be tracked using redirect'); - assertTrackingRequest($(_s('#ex110')).attr('href'), 'piwik.php?redirecturl=' + toEncodedAbsoluteUrl('/example') + '&c_i=click&c_n=MyName&c_p=img.jpg&c_t=' + originEncoded + '%2Fexample', 'trackContentImpressionClickInteraction, the href link should be replaced with a redirect link to tracker'); + assertTrackingRequest($(_s('#ex110')).attr('href'), 'matomo.php?redirecturl=' + toEncodedAbsoluteUrl('/example') + '&c_i=click&c_n=MyName&c_p=img.jpg&c_t=' + originEncoded + '%2Fexample', 'trackContentImpressionClickInteraction, the href link should be replaced with a redirect link to tracker'); actual = (tracker.trackContentImpressionClickInteraction(_s('#ex111')))({target: _s('#ex111')}); strictEqual(actual, 'href', 'trackContentImpressionClickInteraction, should detect it is a link to same page'); - strictEqual($(_s('#ex111')).attr('href'), 'piwik.php?xyz=makesnosense', 'trackContentImpressionClickInteraction, a tracking link should not be changed'); + strictEqual($(_s('#ex111')).attr('href'), 'matomo.php?xyz=makesnosense', 'trackContentImpressionClickInteraction, a tracking link should not be changed'); actual = (tracker.trackContentImpressionClickInteraction(_s('#ex112')))({target: _s('#ex112')}); assertTrackingRequest(actual, 'c_i=click&c_n=img.jpg&c_p=img.jpg&c_t=' + toEncodedAbsoluteUrl('#example'), 'trackContentImpressionClickInteraction, a link that is an anchor should be tracked as XHR and no redirect'); @@ -1974,7 +1974,7 @@ function PiwikTest() { actual = (tracker.trackContentImpressionClickInteraction(_s('#ex108')))({target: _s('#ex108')}); strictEqual(actual, 'link', 'trackContentImpressionClickInteraction, should not track as is an outlink and link tracking enabled'); - $(_s('#ex109')).attr('href', '/file.pdf'); // reset download link as was replaced with piwik.php + $(_s('#ex109')).attr('href', '/file.pdf'); // reset download link as was replaced with matomo.php actual = (tracker.trackContentImpressionClickInteraction(_s('#ex109')))({target: _s('#ex109')}); strictEqual(actual, 'download', 'trackContentImpressionClickInteraction, should not track as is a download and link tracking enabled'); @@ -2069,20 +2069,20 @@ function PiwikTest() { ok('test replaceHrefIfInternalLink()') var trackerUrl = tracker.getTrackerUrl(); - tracker.setTrackerUrl('piwik.php'); + tracker.setTrackerUrl('matomo.php'); strictEqual(tracker.replaceHrefIfInternalLink(), false, 'no content node set'); strictEqual(tracker.replaceHrefIfInternalLink(_s('#ex117')), false, 'should be ignored'); $(_s('#ignoreInternalLink')).removeClass('piwikContentIgnoreInteraction'); // now it should be no longer ignored and as it is an intenral link replaced strictEqual(tracker.replaceHrefIfInternalLink(_s('#ex117')), true, 'should be replaced as is internal link'); - assertTrackingRequest($(_s('#ignoreInternalLink')).attr('href'), 'piwik.php?redirecturl=' + toEncodedAbsoluteUrl('/internallink') + '&c_i=click&c_n=Unknown&c_p=Unknown&c_t=' + originEncoded + '%2Finternallink', 'internal link should be replaced'); + assertTrackingRequest($(_s('#ignoreInternalLink')).attr('href'), 'matomo.php?redirecturl=' + toEncodedAbsoluteUrl('/internallink') + '&c_i=click&c_n=Unknown&c_p=Unknown&c_t=' + originEncoded + '%2Finternallink', 'internal link should be replaced'); strictEqual($(_s('#ignoreInternalLink')).attr('data-content-target'), origin + '/internallink', 'we need to set data-content-target when link is set otherwise a replace would not be found'); strictEqual(tracker.replaceHrefIfInternalLink(_s('#ex122')), true, 'should be replaced'); strictEqual($(_s('#replacedLinkWithTarget')).attr('data-content-target'), '/test', 'should replace href but not a data-content-target if already exists'); strictEqual(tracker.replaceHrefIfInternalLink(_s('#ex118')), true, 'should not replace already replaced link'); - strictEqual($(_s('#ex118')).attr('href'), 'piwik.php?test=5', 'link should not be replaced'); + strictEqual($(_s('#ex118')).attr('href'), 'matomo.php?test=5', 'link should not be replaced'); strictEqual(tracker.replaceHrefIfInternalLink(_s('#ex119')), false, 'anchor link should not be replaced'); strictEqual($(_s('#ex119')).attr('href'), '#test', 'link should not replace anchor link'); @@ -2091,7 +2091,7 @@ function PiwikTest() { strictEqual($(_s('#ex120')).attr('href'), 'http://www.example.com', 'should not replace external link'); strictEqual(tracker.replaceHrefIfInternalLink(_s('#ex121')), true, 'should replace download link if link tracking not enabled'); - assertTrackingRequest($(_s('#ex121')).attr('href'), 'piwik.php?redirecturl=' + toEncodedAbsoluteUrl('/download.pdf') + '&c_i=click&c_n=Unknown&c_p=Unknown&c_t=' + originEncoded + '%2Fdownload.pdf', 'should replace download link as link tracking disabled'); + assertTrackingRequest($(_s('#ex121')).attr('href'), 'matomo.php?redirecturl=' + toEncodedAbsoluteUrl('/download.pdf') + '&c_i=click&c_n=Unknown&c_p=Unknown&c_t=' + originEncoded + '%2Fdownload.pdf', 'should replace download link as link tracking disabled'); $(_s('#ex121')).attr('href', '/download.pdf'); // reset link tracker.enableLinkTracking(); @@ -2510,7 +2510,7 @@ function PiwikTest() { equal( typeof tracker.hook.test._titleFixup, 'function', 'titleFixup' ); equal( tracker.hook.test._titleFixup( 'hello' ), 'hello', 'hello string' ); - equal( tracker.hook.test._titleFixup( document.title ), 'piwik.js: Unit Tests', 'hello string' ); + equal( tracker.hook.test._titleFixup( document.title ), 'matomo.js: Unit Tests', 'hello string' ); equal( typeof tracker.hook.test._purify, 'function', 'purify' ); @@ -3048,7 +3048,7 @@ function PiwikTest() { expect(4); var tracker = Piwik.getTracker(); - tracker.setTrackerUrl("piwik.php"); + tracker.setTrackerUrl("matomo.php"); tracker.setSiteId(1); cookieName = tracker.hook.test._getCookieName('testing'); @@ -3139,20 +3139,20 @@ function PiwikTest() { tracker.setDownloadClasses([]); tracker.setLinkClasses([]); - equal( tracker.hook.test._getLinkType('something', 'piwik.php', false), 'link', 'an empty tracker url should not match configtrackerurl' ); + equal( tracker.hook.test._getLinkType('something', 'matomo.php', false), 'link', 'an empty tracker url should not match configtrackerurl' ); runTests('without tracker url, '); - tracker.setTrackerUrl('piwik.php'); + tracker.setTrackerUrl('matomo.php'); tracker.setDownloadClasses([]); tracker.setLinkClasses([]); tracker.setDownloadExtensions(downloadExtensions); runTests('with tracker url, '); - equal( tracker.hook.test._getLinkType('something', 'piwik.php', true, false), 0, 'matches tracker url and should never return any tracker Url' ); - equal( tracker.hook.test._getLinkType('something', 'piwik.php?redirecturl=http://example.com/test.pdf', true, false), 0, 'should not match download as is config tracker url' ); - equal( tracker.hook.test._getLinkType('something', 'piwik.php?redirecturl=http://example.com/', true, false), 0, 'should not match link as is config tracker url' ); + equal( tracker.hook.test._getLinkType('something', 'matomo.php', true, false), 0, 'matches tracker url and should never return any tracker Url' ); + equal( tracker.hook.test._getLinkType('something', 'matomo.php?redirecturl=http://example.com/test.pdf', true, false), 0, 'should not match download as is config tracker url' ); + equal( tracker.hook.test._getLinkType('something', 'matomo.php?redirecturl=http://example.com/', true, false), 0, 'should not match link as is config tracker url' ); tracker.setTrackerUrl(trackerUrl); }); @@ -3486,13 +3486,13 @@ function PiwikTest() { equal( getPiwikUrlForOverlay('http://www.example.com/tracker.php?version=232323'), 'http://www.example.com/', 'with query and no js folder' ); equal( getPiwikUrlForOverlay('http://www.example.com/js/tracker.php'), 'http://www.example.com/', 'no query, custom tracker and js folder' ); equal( getPiwikUrlForOverlay('http://www.example.com/tracker.php'), 'http://www.example.com/', 'no query, custom tracker and no js folder' ); - equal( getPiwikUrlForOverlay('http://www.example.com/js/piwik.php'), 'http://www.example.com/', 'with piwik.php and no js folder' ); - equal( getPiwikUrlForOverlay('http://www.example.com/piwik.php'), 'http://www.example.com/', 'with piwik.php and no js folder' ); - equal( getPiwikUrlForOverlay('http://www.example.com/master/js/piwik.php'), 'http://www.example.com/master/', 'installed in custom folder and js folder' ); - equal( getPiwikUrlForOverlay('http://www.example.com/master/piwik.php'), 'http://www.example.com/master/', 'installed in custom folder and no js folder' ); - equal( getPiwikUrlForOverlay('/piwik.php'), toAbsoluteUrl('/'), 'only piwik.php with leading slash' ); - equal( getPiwikUrlForOverlay('piwik.php'), toAbsoluteUrl(''), 'only piwik.php' ); - equal( getPiwikUrlForOverlay('/piwik.php?version=1234'), toAbsoluteUrl('/'), 'only piwik.php with leading slash with query' ); + equal( getPiwikUrlForOverlay('http://www.example.com/js/matomo.php'), 'http://www.example.com/', 'with matomo.php and no js folder' ); + equal( getPiwikUrlForOverlay('http://www.example.com/matomo.php'), 'http://www.example.com/', 'with matomo.php and no js folder' ); + equal( getPiwikUrlForOverlay('http://www.example.com/master/js/matomo.php'), 'http://www.example.com/master/', 'installed in custom folder and js folder' ); + equal( getPiwikUrlForOverlay('http://www.example.com/master/matomo.php'), 'http://www.example.com/master/', 'installed in custom folder and no js folder' ); + equal( getPiwikUrlForOverlay('/matomo.php'), toAbsoluteUrl('/'), 'only matomo.php with leading slash' ); + equal( getPiwikUrlForOverlay('matomo.php'), toAbsoluteUrl(''), 'only matomo.php' ); + equal( getPiwikUrlForOverlay('/matomo.php?version=1234'), toAbsoluteUrl('/'), 'only matomo.php with leading slash with query' ); }); function generateAnIframeInDocument() { @@ -3504,7 +3504,7 @@ function PiwikTest() { var html = '\ \ \ - \ + \ \ \ window.onload = function() { \ @@ -3591,7 +3591,7 @@ if ($mysql) { }; var tracker = Piwik.getTracker(); - tracker.setTrackerUrl("piwik.php"); + tracker.setTrackerUrl("matomo.php"); tracker.setSiteId(1); strictEqual(0, tracker.getNumTrackedPageViews(), 'getNumTrackedPageViews, is zero by default'); @@ -3602,19 +3602,19 @@ if ($mysql) { } equal(tracker.getPiwikUrl(), piwikUrl, "getPiwikUrl, relative tracker url" ); - tracker.setTrackerUrl("http://apache.piwik/piwik.php"); + tracker.setTrackerUrl("http://apache.piwik/matomo.php"); equal(tracker.getPiwikUrl(), 'http://apache.piwik/', "getPiwikUrl, in root directory" ); tracker.setTrackerUrl("http://apache.piwik/tracker.php"); equal(tracker.getPiwikUrl(), 'http://apache.piwik/', "getPiwikUrl, with different file name" ); - tracker.setTrackerUrl("http://apache.piwik/tests/javascript/piwik.php?x=1"); + tracker.setTrackerUrl("http://apache.piwik/tests/javascript/matomo.php?x=1"); equal(tracker.getPiwikUrl(), 'http://apache.piwik/tests/javascript/', "getPiwikUrl, with path and query" ); - tracker.setTrackerUrl("http://apache.piwik/js/piwik.php?x=1"); + tracker.setTrackerUrl("http://apache.piwik/js/matomo.php?x=1"); equal(tracker.getPiwikUrl(), 'http://apache.piwik/', "getPiwikUrl, when using unminified piwik.js" ); - tracker.setTrackerUrl("piwik.php"); + tracker.setTrackerUrl("matomo.php"); var thirteenMonths = 1000 * 60 * 60 * 24 * 393; strictEqual(thirteenMonths, tracker.getConfigVisitorCookieTimeout(), 'default visitor timeout should be 13 months'); @@ -3750,7 +3750,7 @@ if ($mysql) { tracker.setRequestMethod("POST"); tracker.trackGoal(42, 69, { "token" : getToken(), "boy" : "Michael", "girl" : "Mandy"}); - piwik_log("CompatibilityLayer", 1, "piwik.php", { "token" : getToken() }); + piwik_log("CompatibilityLayer", 1, "matomo.php", { "token" : getToken() }); tracker.hook.test._addEventListener(_e("click8"), "click", stopEvent); triggerEvent(_e("click8"), 'click'); @@ -3866,7 +3866,7 @@ if ($mysql) { tracker.trackPageView("MultipleCategories"); var tracker2 = Piwik.getTracker(); - tracker2.setTrackerUrl("piwik.php"); + tracker2.setTrackerUrl("matomo.php"); tracker2.setSiteId(1); tracker2.storeCustomVariablesInCookie(); tracker2.setCustomData({ "token" : getToken() }); @@ -3883,7 +3883,7 @@ if ($mysql) { tracker2.trackPageView("DeleteCustomVariableCookie"); var tracker3 = Piwik.getTracker(); - tracker3.setTrackerUrl("piwik.php"); + tracker3.setTrackerUrl("matomo.php"); tracker3.setSiteId(1); tracker3.setCustomData({ "token" : getToken() }); tracker3.setCookieNamePrefix("PREFIX"); @@ -3977,7 +3977,7 @@ if ($mysql) { stop(); setTimeout(function() { - xhr.open("GET", "piwik.php?requests=" + getToken(), false); + xhr.open("GET", "matomo.php?requests=" + getToken(), false); xhr.send(null); results = xhr.responseText; equal( (/([0-9]+)\<\/span\>/.exec(results))[1], "40", "count tracking events" ); @@ -3987,7 +3987,7 @@ if ($mysql) { // tracking requests ok( /PiwikTest/.test( results ), "trackPageView(), setDocumentTitle()" ); - 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( results.indexOf("tests/javascript/matomo.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" ); @@ -4083,8 +4083,8 @@ if ($mysql) { ok( /e_c=JavaScript%20Errors&e_a=http%3A%2F%2Fpiwik.org%2Fpath%2Fto%2Ffile.js%3Fcb%3D34343%3A44%3A12&e_n=Uncaught%20Error%3A%20The%20message&idsite=1/.test( results ), "enableJSErrorTracking() function with predefined onerror event"); ok( /e_c=JavaScript%20Errors&e_a=http%3A%2F%2Fpiwik.org%2Fpath%2Fto%2Ffile.js%3Fcb%3D3kfkf%3A45&e_n=Second%20Error%3A%20With%20less%20data&idsite=1/.test( results ), "enableJSErrorTracking() function without predefined onerror event and less parameters"); - ok( /piwik.php\?action_name=twoTrackers&idsite=1&/.test( results ), "addTracker() trackPageView() sends request to both Piwik instances"); - ok( /piwik.php\?action_name=twoTrackers&idsite=13&/.test( results ), "addTracker() trackPageView() sends request to both Piwik instances"); + ok( /matomo.php\?action_name=twoTrackers&idsite=1&/.test( results ), "addTracker() trackPageView() sends request to both Piwik instances"); + ok( /matomo.php\?action_name=twoTrackers&idsite=13&/.test( results ), "addTracker() trackPageView() sends request to both Piwik instances"); start(); }, 5000); @@ -4097,7 +4097,7 @@ if ($mysql) { var tokenBase = getHeartbeatToken(); var tracker = Piwik.getTracker(); - tracker.setTrackerUrl("piwik.php"); + tracker.setTrackerUrl("matomo.php"); tracker.setSiteId(1); tracker.enableHeartBeatTimer(3); @@ -4186,7 +4186,7 @@ if ($mysql) { message += ', '; } - expectedStartsWith = '' + toAbsolutePath('piwik.php') + '?' + expectedStartsWith; + expectedStartsWith = '' + toAbsolutePath('matomo.php') + '?' + expectedStartsWith; strictEqual(actual.indexOf(expectedStartsWith), 0, message + actual + ' should start with ' + expectedStartsWith); strictEqual(actual.indexOf('&idsite=1&rec=1'), expectedStartsWith.length); @@ -4203,7 +4203,7 @@ if ($mysql) { var token = getContentToken(); var tracker = Piwik.getTracker(); - tracker.setTrackerUrl("piwik.php"); + tracker.setTrackerUrl("matomo.php"); tracker.setSiteId(1); resetTracker(tracker, token); @@ -4620,7 +4620,7 @@ if ($mysql) { message += ', '; } - expectedStartsWith = '' + toAbsolutePath('piwik.php') + '?' + expectedStartsWith; + expectedStartsWith = '' + toAbsolutePath('matomo.php') + '?' + expectedStartsWith; strictEqual(actual.indexOf(expectedStartsWith), 0, message + actual + ' should start with ' + expectedStartsWith); strictEqual(actual.indexOf('&idsite=1&rec=1'), expectedStartsWith.length); @@ -4645,7 +4645,7 @@ if ($mysql) { var actual, expected, trackerUrl; var tracker = Piwik.getTracker(); - tracker.setTrackerUrl("piwik.php"); + tracker.setTrackerUrl("matomo.php"); tracker.setSiteId(1); resetTracker(tracker, token); @@ -4694,7 +4694,7 @@ if ($mysql) { var token5 = '5' + token; resetTracker(tracker, token5); preventClickDefault('#internalLink'); - var expectedLink = toAbsoluteUrl('piwik.php') + '?redirecturl=' + toEncodedAbsoluteUrl('/anylink5') + '&c_i=click&c_n=My%20Ad%205&c_p=http%3A%2F%2Fimg5.example.com%2Fpath%2Fxyz.jpg&c_t=' + originEncoded + '%2Fanylink5&idsite=1&rec=1'; + var expectedLink = toAbsoluteUrl('matomo.php') + '?redirecturl=' + toEncodedAbsoluteUrl('/anylink5') + '&c_i=click&c_n=My%20Ad%205&c_p=http%3A%2F%2Fimg5.example.com%2Fpath%2Fxyz.jpg&c_t=' + originEncoded + '%2Fanylink5&idsite=1&rec=1'; var newHref = _s('#internalLink').href; strictEqual(0, newHref.indexOf(expectedLink), 'replaced href is replaced: ' + newHref); // make sure was already replace by trackContentImpressions() strictEqual(_s('#internalLink').wasContentTargetAttrReplaced, true, 'has to be marked as replaced so we know we have to update content target again in case the url changes meanwhile'); @@ -4705,7 +4705,7 @@ if ($mysql) { triggerEvent(_s('#internalLink'), 'click'); // should replace href php newHref = _s('#internalLink').href; - expectedLink = toAbsoluteUrl('piwik.php') + '?redirecturl=' + toEncodedAbsoluteUrl('/newlink') + '&c_i=click&c_n=My%20Ad%205&c_p=http%3A%2F%2Fimg5.example.com%2Fpath%2Fxyz.jpg&c_t=' + originEncoded + '%2Fnewlink&idsite=1&rec=1'; + expectedLink = toAbsoluteUrl('matomo.php') + '?redirecturl=' + toEncodedAbsoluteUrl('/newlink') + '&c_i=click&c_n=My%20Ad%205&c_p=http%3A%2F%2Fimg5.example.com%2Fpath%2Fxyz.jpg&c_t=' + originEncoded + '%2Fnewlink&idsite=1&rec=1'; strictEqual(0, newHref.indexOf(expectedLink), 'replaced href2 is replaced again: ' + newHref); // make sure was already replace by trackContentImpressions() wait(300); @@ -4920,7 +4920,7 @@ function customAddEventListener(element, eventType, eventHandler, useCapture) {