Skip to main content
Skip table of contents

How do I add Surfly's co-browsing to my website?

If you want to be able to start co-browsing directly from your website, you have to add the Surfly snippet to each page you want to be able to start a session from. If you have access to the code, you can add the below script right above the closing </body> tag of your HTML.

If you use a website builder, you probably have an option there where you can add code to your web pages.

You can also use a Tag Manager to add the Surfly snippet to your website.

CODE
<script>
(function(s,u,r,f,l,y){s[f]=s[f]||{init:function(){s[f].q=arguments}};
l=u.createElement(r);y=u.getElementsByTagName(r)[0];l.async=1;
l.src='https://surfly.com/surfly.js';y.parentNode.insertBefore(l,y);})
(window,document,'script','Surfly');

var settings = {
// Surfly session options can be set here, or at the Company/Plan levels.
widget_key: '656bad009e114ca49b13b1c2960693d4',
require_password: false,
};

Surfly.init(settings, function(initResult) {
    if (initResult.success) {
        // API calls can now be made!
        if (!Surfly.isInsideSession) {
            Surfly.button();
        }
    }
    else{
        console.log("Surfly was unable to initialize properly.")
    }
});
</script>

Should I put the Surfly snippet on every page of my website? Read here >>

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.