Last active

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

Updating to the latest Intercom javascript

View instructions.md

Background

We have started serving the Intercom javascript via a CDN. Previously all requests for the Intercom javascript library hit our API servers (api.intercom.io) in the east coast of USA. This added unnecessary additional latency to each request for the library. Loading the library from the CDN means people will fetch it from a server much closer to them, and the Intercom javascript will load faster on your site.

How to upgrade.

Intercom is installed on your site by including some script tags. One contains your Intercom settings, the other contains the loader script for loading Intercom which looks like:

<script>(function(){var w=window;var ic=w.Intercom;if(typeof ic==="function"){ic('reattach_activator');ic('update',intercomSettings);}else{var d=document;var i=function(){i.c(arguments)};i.q=[];i.c=function(args){i.q.push(args)};w.Intercom=i;function l(){var s=d.createElement('script');s.type='text/javascript';s.async=true;s.src='https://api.intercom.io/api/js/library.js';var x=d.getElementsByTagName('script')[0];x.parentNode.insertBefore(s,x);}if(w.attachEvent){w.attachEvent('onload',l);}else{w.addEventListener('load',l,false);}};})()</script>

You need to replace the url:

https://api.intercom.io/api/js/library.js

with

https://static.intercomcdn.com/intercom.v1.js

REST API

No changes are required for those using the REST API or client libraries. This is only relevant to those using our javascript integration.

Rails

If you are using our intercom-rails rubygem - then all you need to do is upgrade to the latest version.

More help??

Get in touch at darragh@intercom.io

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.