analytics.js-loader icon indicating copy to clipboard operation
analytics.js-loader copied to clipboard

Added onload option

Open Flushot opened this issue 8 years ago • 2 comments

Added an onload callback option that gets invoked after the script tag loads.

Flushot avatar Aug 30 '16 20:08 Flushot

Hi! Thanks for contributing.

I'd rather add an option like this:

var analytics = require('analytics.js-loader')({
  onScript: function(scriptElement) {

  }
});

Then you could do anything on it like addEventListener etc..

Works?

vvo avatar Aug 31 '16 09:08 vvo

That works. I basically just needed an onload callback so that I could set a custom anonymous ID with window.analytics.user().anonymousId(foo) once their script loaded.

Flushot avatar Sep 02 '16 00:09 Flushot