Permalink
Browse files

Added forceAsync option

  • Loading branch information...
1 parent 830f1f6 commit d97810e02b4b7f21be70e9b2fdf11a170948a146 jakearchibald committed Sep 18, 2009
Showing with 8 additions and 2 deletions.
  1. +8 −2 src/linktracker.js
View
@@ -53,6 +53,11 @@ var tracking = (function() {
within the current page
@param {String[]} [opts.protocols] Which protocols should be logged?
By default, the following protocols are logged: ['http', 'https', 'ftp']
+ @param {Boolean} [opts.forceAsync=false] Should all tracking requests be made async?
+ This means your returned url never needs to redirect. However, you will
+ lose some tracking data if the browser leaves the page before the
+ async request is made.
+
@example
function createTrackingLink(linkElm, button, redirect) {
@@ -193,7 +198,7 @@ var tracking = (function() {
}
// do it async for right clicks or this page links
- return (isThisPage || linkTracker._upBtn === 2) ? 2 : 1;
+ return (linkTracker._o.forceAsync || isThisPage || linkTracker._upBtn === 2) ? 2 : 1;
}
// get / set attributes
@@ -302,7 +307,8 @@ var tracking = (function() {
trackRightClicks: false,
trackMiddleClicks: true,
trackingLevel: 0,
- protocols: defaultProtocols
+ protocols: defaultProtocols,
+ forceAsync: false
},
i;

0 comments on commit d97810e

Please sign in to comment.