Fixed issue with duplicate events - closes #243
Andrew Kane
committed Jan 23, 2017
commit c59ff8e9afb3bcc8f2e5050fe6db3623ed37d0a6
Showing 1
changed file with
11 additions
and 11 deletions
vendor/assets/javascripts/ahoy.js
+11
-11
| @@ | @@ -375,19 +375,19 @@ |
| ahoy.trackChanges(); | |
| }; | |
| - | ahoy.start = function () { |
| - | createVisit(); |
| + | // push events from queue |
| + | try { |
| + | eventQueue = JSON.parse(getCookie("ahoy_events") || "[]"); |
| + | } catch (e) { |
| + | // do nothing |
| + | } |
| - | // push events from queue |
| - | try { |
| - | eventQueue = JSON.parse(getCookie("ahoy_events") || "[]"); |
| - | } catch (e) { |
| - | // do nothing |
| - | } |
| + | for (var i = 0; i < eventQueue.length; i++) { |
| + | trackEvent(eventQueue[i]); |
| + | } |
| - | for (var i = 0; i < eventQueue.length; i++) { |
| - | trackEvent(eventQueue[i]); |
| - | } |
| + | ahoy.start = function () { |
| + | createVisit(); |
| ahoy.start = function () {}; | |
| }; | |