Skip to content
Permalink
43887b4428
Go to file
 
 
Cannot retrieve contributors at this time
44 lines (32 sloc) 1.27 KB
// Klaviyo
// --------
// Last updated: December 12th, 2012
// [Documentation](https://www.klaviyo.com/docs).
// [Documentation](https://www.klaviyo.com/docs/http-api).
analytics.addProvider('Klaviyo', {
settings : {
apiKey : null
},
initialize : function (settings) {
settings = analytics.utils.resolveSettings(settings, 'apiKey');
analytics.utils.extend(this.settings, settings);
var _learnq = _learnq || [];
_learnq.push(['account', this.settings.apiKey]);
(function () {
var b = document.createElement('script'); b.type = 'text/javascript'; b.async = true;
b.src = ('https:' == document.location.protocol ? 'https://' : 'http://') +
'a.klaviyo.com/media/js/learnmarklet.js';
var a = document.getElementsByTagName('script')[0]; a.parentNode.insertBefore(b, a);
})();
window._learnq = _learnq;
},
identify : function (userId, traits) {
traits || (traits = {});
// Klaviyo takes the user ID on the traits object itself.
if (userId) traits.$id = userId;
window._learnq.push(['identify', traits]);
},
track : function (event, properties) {
window._learnq.push(['track', event, properties]);
}
});
You can’t perform that action at this time.