Sometimes, you want your Webchat widget to appear on some web pages, not the entire website.
In this article, we’ll explain how to achieve this.
Copy Snippet Code
- Choose Administration > Channels from the left menu.
- Pick your Webchat channel and click Edit.
- Click the Settings tab.
- In the Deploy section, click the Copy Snippet button.
This is how your code will look:
<div id="embedded_messenger">
<div id="widget-launcher"></div>
<iframe id="dstnyEngage_client" src="https://webchat.dstnyengage.com/webchat/chatChannel.html"></iframe>
</div>
<script src="https://webchat.dstnyengage.com/webchat/embed/embed.js"></script>
<link rel="stylesheet" href="https://webchat.dstnyengage.com/webchat/css/embed.css" />
<script>
var profileId = "xxx";
var token = "fdd037653f16.......7559378";
DstnyEngage.start({ profileId: profileId, token: token });
</script>
Divide the Code
Add this part of your code between the website <head></head> tags:
<script src="https://webchat.dstnyengage.com/webchat/embed/embed.js"></script>
<link rel="stylesheet" href="https://webchat.dstnyengage.com/webchat/css/embed.css" />
Then add the rest of the code immediately before the /body> tag in the page(s) you wish to display the Webchat widget on:
<div id="embedded_messenger">
<div id="widget-launcher"></div>
<iframe id="dstnyEngage_client" src="https://webchat.dstnyengage.com/webchat/chatChannel.html"></iframe>
</div>
<script>
var profileId = "xxx";
var token = "fdd037653f16.......7559378";
DstnyEngage.start({ profileId: profileId, token: token });
</script>