Skip to content

Instantly share code, notes, and snippets.

@plcstevens
Last active April 6, 2016 10:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save plcstevens/8ebee934045d690a3c96 to your computer and use it in GitHub Desktop.
Save plcstevens/8ebee934045d690a3c96 to your computer and use it in GitHub Desktop.
This is how a client can implement their own callbacks onto our badge actions.
(function() {
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = 'http://cdn.mark.reevoo.com/assets/reevoo_mark.js';
var s = document.getElementById('reevoomark-loader');
s.parentNode.insertBefore(script, s);
})();
afterReevooMarkLoaded = [function(){
ReevooApi.load('YOUR_TRKREF', function(retailer){
retailer.observe("load", function(badge) {
alert("ReevooMark product details loading");
// badge has a number of accessible variables such as:
badge.target; // the document element we are targetting with this badge
badge.badge_type; // the type of badge we are dealing with, defaults to product_reviews
badge.badge_variant; // the badge variant, defaults to default
badge.badge_name; // the badge name, specified by the retailers badge style, defaults to null
badge.review_count; // number of reviews for this product
badge.scores_count; // the score for this product
badge.should_show_badge; // whether or not this badge should be displayed
badge.sku; // the sku for this product
});
retailer.observe("complete", function(badge){
alert("ReevooMark product details loaded");
});
retailer.observe("click", function(badge){
alert("ReevooMark badge clicked");
});
retailer.init_badges();
retailer.init_reevoo_reputation_badges();
});
}];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment