Skip to content

Commit 694fcf9

Browse files
committedApr 2, 2019
auto-tracking tracking position pointer
1 parent 645b0dc commit 694fcf9

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed
 

‎lib/browser-auto-tracking.js

+12-2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export function initAutoTrackingCore(lib) {
1010
ignoreDisabledFormFields: false,
1111
ignoreFormFieldTypes: ['password'],
1212
recordClicks: true,
13+
recordClicksPositionPointer: false,
1314
recordFormSubmits: true,
1415
recordPageViews: true,
1516
recordPageViewsOnExit: false,
@@ -196,11 +197,20 @@ export function initAutoTrackingCore(lib) {
196197
if (options.recordClicks === true) {
197198
utils.listener('a, a *').on('click', function(e) {
198199
const el = e.target;
199-
const event = {
200+
let event = {
200201
element: helpers.getDomNodeProfile(el),
201-
local_time_full: new Date().toISOString()
202+
local_time_full: new Date().toISOString(),
202203
};
203204

205+
// pointer position tracking
206+
if(options.recordClicksPositionPointer === true) {
207+
const pointer = {
208+
x_position: e.pageX,
209+
y_position: e.pageY,
210+
}
211+
event = {...event, pointer};
212+
}
213+
204214
if (options.catchError) {
205215
return client
206216
.recordEvent({

0 commit comments

Comments
 (0)
Please sign in to comment.