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:
authorThomas Steur <thomas.steur@googlemail.com>2014-08-28 13:56:58 +0400
committerThomas Steur <thomas.steur@googlemail.com>2014-08-28 13:56:58 +0400
commitcefc83a5ed6078bcdcea3a0c47fa4dcf435ea11f (patch)
tree560a90819303de808a7cdfb754115547b53dcd05 /js
parentf9219dff1bcb5b21bccc56c5b09b5de68cdc3a2b (diff)
refs #4996 this should actually track impressions
Diffstat (limited to 'js')
-rw-r--r--js/piwik.js51
1 files changed, 37 insertions, 14 deletions
diff --git a/js/piwik.js b/js/piwik.js
index 1e4b3e4825..f71632c021 100644
--- a/js/piwik.js
+++ b/js/piwik.js
@@ -1360,9 +1360,9 @@ if (typeof Piwik !== 'object') {
var target = this.findContentTarget(node);
return {
- c_n: name ? name : 'Unknown',
- c_p: piece ? piece : 'Unknown',
- c_t: target ? target : ''
+ name: name ? name : 'Unknown',
+ piece: piece ? piece : 'Unknown',
+ target: target ? target : ''
};
},
collectContent: function ()
@@ -1817,6 +1817,23 @@ if (typeof Piwik !== 'object') {
}
/*
+ * Send requests using bulk
+ */
+ function sendBulkRequest(requests, delay) {
+
+ if (configDoNotTrack) {
+ return;
+ }
+
+ var now = new Date();
+ var bulk = '{"requests":["?' + requests.join('",?"') + '"]}';
+
+ sendXmlHttpRequest(bulk);
+
+ expireDateTime = now.getTime() + delay;
+ }
+
+ /*
* Get cookie name with prefix and domain hash
*/
function getCookieName(baseName) {
@@ -2390,18 +2407,24 @@ if (typeof Piwik !== 'object') {
function logContentPieces() {
var contents = content.collectContent();
- // sendRequest(request, configTrackerPause);
- /**
- * {
- "requests": [
- "?idsite=1&url=http://example.org&action_name=Test bulk log Pageview&rec=1",
- "?idsite=1&url=http://example.net/test.htm&action_name=Another bul k page view&rec=1"
- ],
- "token_auth": "33dc3f2536d3025974cccb4b4d2d98f4"
-}
- */
+ var index, request;
+ var requests = [];
+
+ for (index = 0; index < contents.length; index++) {
+
+ request = getRequest(
+ 'c_n=' + encodeWrapper(contents[index].name) +
+ '&c_p=' + encodeWrapper(contents[index].piece) +
+ '&c_t=' + encodeWrapper(contents[index].target),
+ undefined,
+ 'content'
+ );
+
+ requests.push(request);
+
+ }
- // send bulk tracking request?
+ sendBulkRequest(requests, configTrackerPause);
}
/*