Created
December 6, 2018 00:28
-
-
Save fIa5h/9bf6436f5c39d745cd907368483b4e36 to your computer and use it in GitHub Desktop.
Use live Intercom events without a hard page refresh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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