Skip to content
This repository was archived by the owner on Oct 11, 2022. It is now read-only.

Commit 0ace84f

Browse files
fblundunalexanderdean
authored andcommitted
Added page scroll parameters to trackPagePing (fixes snowplow#257)
1 parent 3909439 commit 0ace84f

3 files changed

Lines changed: 16 additions & 4 deletions

File tree

core/CHANGELOG

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Version 0.3.0 (2014-xx-xx)
22
--------------------------
33
Apply callback to the Payload for an event rather than the event dictionary (#259)
4-
Added page scroll parameters to trackPagePing (#257) (TODO)
4+
Added page scroll parameters to trackPagePing (#257)
55
Added social tracking (#258) (TODO)
66

77
Version 0.2.0 (2014-08-07)

core/lib/core.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,16 +280,24 @@ function trackerCore(base64, callback) {
280280
* by sending a page ping.
281281
*
282282
* @param string pageTitle The page title to attach to this page ping
283+
* @param minxoffset Minimum page x offset seen in the last ping period
284+
* @param maxXOffset Maximum page x offset seen in the last ping period
285+
* @param minYOffset Minimum page y offset seen in the last ping period
286+
* @param maxYOffset Maximum page y offset seen in the last ping period
283287
* @param array context Custom contexts relating to the event
284288
* @param number tstamp Timestamp of the event
285289
* @return object Payload
286290
*/
287-
trackPagePing: function (pageUrl, pageTitle, referrer, context, tstamp) {
291+
trackPagePing: function (pageUrl, pageTitle, referrer, minXOffset, maxXOffset, minYOffset, maxYOffset, context, tstamp) {
288292
var sb = payload.payloadBuilder(base64);
289293
sb.add('e', 'pp'); // 'pv' for Page View
290294
sb.add('url', pageUrl);
291295
sb.add('page', pageTitle);
292296
sb.add('refr', referrer);
297+
sb.add('pp_mix', minXOffset);
298+
sb.add('pp_max', maxXOffset);
299+
sb.add('pp_miy', minYOffset);
300+
sb.add('pp_may', maxYOffset);
293301

294302
return track(sb, context, tstamp);
295303
},

core/tests/core.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,14 @@ define([
5151
var expected = {
5252
e: 'pp',
5353
url: url,
54-
refr: referer
54+
refr: referer,
55+
pp_mix: 1,
56+
pp_max: 2,
57+
pp_miy: 3,
58+
pp_may: 4
5559
};
5660

57-
compare(tracker.trackPagePing(url, null, referer), expected, 'A page ping should be tracked correctly');
61+
compare(tracker.trackPagePing(url, null, referer, 1, 2, 3, 4), expected, 'A page ping should be tracked correctly');
5862
},
5963

6064
"Track a structured event": function () {

0 commit comments

Comments
 (0)