snippet.js
Version:
The JavaScript snippet for Chameleon
22 lines (18 loc) • 554 B
JavaScript
// Add the snippet here with account id (i.e. config.chameleonAccountId)
// Assuming you call `currentUserLoaded` after fetching the user
(function() {
var currentUserLoaded = function(currentUser) {
chmln.setup({
uid: currentUser.id,
created: currentUser.createdAt,
email: currentUser.email,
plan: currentUser.planName,
spend: currentUser.planCost
});
};
var xhr = $.get('/user.json');
xhr.done(function(data) {
// Setup other aspects of the environment
currentUserLoaded(data.user);
});
})();