@mate-academy/sourcebuster
Version:
Get sources of your site's visitors (utm / organic / referral / typein).
20 lines (15 loc) • 456 B
JavaScript
;
var init = require('./init');
var sbjs = {
init: function(prefs) {
this.get = init(prefs);
if (prefs && prefs.callback && typeof prefs.callback === 'function') {
prefs.callback(this.get);
}
}
};
module.exports = sbjs;
// Dispatch event when sbjs is available for event-based waiting
if (typeof window !== 'undefined' && typeof CustomEvent !== 'undefined') {
window.dispatchEvent(new CustomEvent('sbjs:loaded'));
}