Skip to content

Instantly share code, notes, and snippets.

@oarashi
Created April 5, 2017 12:00
Show Gist options
  • Save oarashi/d0484d6b5471e4c5413a1054c0ebde77 to your computer and use it in GitHub Desktop.
Save oarashi/d0484d6b5471e4c5413a1054c0ebde77 to your computer and use it in GitHub Desktop.
window._talkableq = window._talkableq || [];
_talkableq.unshift(['init', {site_id: 'le-chateau'}]);
var isCurrentPath = function(paths) {
for (var i = 0; i < paths.length; i++)
if (document.location.href.indexOf(paths[i]) > -1)
return true;
return false;
};
// Post Purchase
window.talkable.before('register_purchase', function(data) {
if (!data.purchase) return;
if (!isCurrentPath(['/style/cart/', '/style/checkout/'])) {
data.campaign_tags = '404';
}
return data;
});
// Widget
window.talkable.before('register_affiliate', function(data) {
if (!data || isCurrentPath(['/style/cart/', '/style/checkout/'])) return;
return data;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment