This answer comes from the Interconnected community forum. 👌

Can I delay loading Intercom on my site to reduce the JS load? i.e. only load it after a page is fully loaded for a visitor?

You can modify the Intercom load function by splitting it out like this, and it runs inside a setTimeout function

// Intercom
window.intercomSettings = {
app_id: "<YOUR WIDGET ID>"

var w = window;
var ic = w.Intercom;
if (typeof ic === "function") {
ic('update', w.intercomSettings);
} else {
var d = document;
var i = function() {
i.q = [];
i.c = function(args) {
w.Intercom = i;
var l = function() {
var s = d.createElement('script');
s.type = 'text/javascript';
s.async = true;
s.src = '<YOUR WIDGET ID>';
var x = d.getElementsByTagName('script')[0];
x.parentNode.insertBefore(s, x);

The difference is that the part that runs l() normally is onLoad and that gets stuffed up after the setTimeout.

You can also strip out the l() function entirely if you like (and just have the variables declared etc) and just run it, as it’ll be wrapped in a setTimeout function.

Read this and other questions here on Interconnected.

Did this answer your question?