Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions template/snippet.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@
// stored as the first argument, so we can replay the data.
analytics.factory = function(method){
return function(){
if (window.analytics.initialized) {
// Sometimes users assigned analytics to a variable before analytics is done loading, resulting in a stale reference.
// If so, proxy any calls to the 'real' analytics instance.
return window.analytics[method].apply(window.analytics, arguments);
}
var args = Array.prototype.slice.call(arguments);
args.unshift(method);
analytics.push(args);
Expand Down