From 6c532d04054a94a1a3e6695fe127e15e690036aa Mon Sep 17 00:00:00 2001 From: Matthias Le Brun Date: Fri, 19 Jun 2015 15:08:31 +0200 Subject: [PATCH] added `forceUnsecureTracker` --- src/js/tracker.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/js/tracker.js b/src/js/tracker.js index e87f85e90..caf12638a 100644 --- a/src/js/tracker.js +++ b/src/js/tracker.js @@ -174,6 +174,8 @@ // This forces the tracker to be HTTPS even if the page is not secure forceSecureTracker = argmap.hasOwnProperty('forceSecureTracker') ? (argmap.forceSecureTracker === true) : false, + forceUnsecureTracker = !forceSecureTracker && argmap.hasOwnProperty('forceUnsecureTracker') ? (argmap.forceUnsecureTracker === true) : false, + // Whether to use localStorage to store events between sessions while offline useLocalStorage = argmap.hasOwnProperty('useLocalStorage') ? argmap.useLocalStorage : true, @@ -674,10 +676,13 @@ * @return string collectorUrl The tracker URL with protocol */ function asCollectorUrl(rawUrl) { - if (forceSecureTracker) + if (forceSecureTracker) { return ('https' + '://' + rawUrl); - else - return ('https:' === documentAlias.location.protocol ? 'https' : 'http') + '://' + rawUrl; + } + if (forceUnsecureTracker) { + return ('http' + '://' + rawUrl); + } + return ('https:' === documentAlias.location.protocol ? 'https' : 'http') + '://' + rawUrl; } /**