Add Facebook Messenger Chat Into Squarespace

Back in May '18 I posted a video explaining how to install Facebook Messenger Customer Chat into Squarespace.

For a while it was all good, but out of nowhere I started getting comments and emails saying that it was either not working, or, for those who had already successfully installed it and been using it fine it had stopped working.

I did a bit of digging to see what was causing it and I eventually found a fix.

Follow the steps in my video through setting up the plugin in Facebook to the section where you paste the code that Facebook has generated into Squarespace’s Advanced Code Injection (Settings > Advanced > Code Injection).

When you paste the code into the footer section it will look something like this:

<script type=”text/javascript”>
var uri = ‘’ + new String (Math.random()).substring (2, 11);
document.write(‘<a href=”″ target=”_BLANK”><img src=”‘+uri+'” border=0></a>’);


Next we need to add a little extra script to the code that Facebook has given us. Copy this small piece of script:

window.fbAsyncInit = function() { FB.init({ xfbml : true, version : ‘v3.2’ }); };

…and paste it directly after the first script tag like so:

    <!– Load Facebook SDK for JavaScript –>
    <div id=”fb-root”></div>
    <script>PASTE THE SCRIPT HERE(function(d, s, id) {
    var js, fjs = d.getElementsByTagName(s)[0];
    if (d.getElementById(id)) return;
    js = d.createElement(s); = id;
    js.src = ‘’;
    fjs.parentNode.insertBefore(js, fjs);
    }(document, ‘script’, ‘facebook-jssdk’));</script>
   <!– Your customer chat code –>
   <div class=”fb-customerchat”

Press ‘Save’ and that should trigger the Messenger Chat plugin.

**Important** Don’t copy all of the code from this page, just the part that you need as I have removed the page id’s in this example