Skip to content

Instantly share code, notes, and snippets.

@fIa5h
Created December 6, 2018 00:28
Show Gist options
  • Save fIa5h/9bf6436f5c39d745cd907368483b4e36 to your computer and use it in GitHub Desktop.
Save fIa5h/9bf6436f5c39d745cd907368483b4e36 to your computer and use it in GitHub Desktop.
Use live Intercom events without a hard page refresh
//does Intercom exist in this scope
if(window.Intercom){
//track our event
window.Intercom("trackEvent", "YOUR EVENT NAME");
setTimeout(function(){
//refresh our user, so we can take actions based off of the action above
Intercom("update", {last_request_at: parseInt((new Date()).getTime()/1000)})
}, 500);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment