Adding LiveChat to your Website

This brief tutorial will demonstrate how to add the LiveChat script to your website.  

Prerequisites

For you need to have the LiveChat chat snippet of code that was provided by LiveChat.  It should look something like this.

LiveChat Script
<!-- Start of LiveChat (www.livechatinc.com) code -->
<script type="text/javascript">
window.__lc = window.__lc || {};
window.__lc.license = 123456;
(function() {
  var lc = document.createElement('script'); lc.type = 'text/javascript'; lc.async = true;
 lc.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'cdn.livechatinc.com/tracking.js';
  var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(lc, s);
})();
</script>
<!-- End of LiveChat code -->

Creating livechat.vm template

The first thing we need to do is create a snippet template that will contain the LiveChat code above.  Click on the File Manager tab within your StoreFront.

Now click on "themes", then your active theme (shown in green) and then "snippets" as shown below.

Now that we're in the snippets folder, click on the new file icon and name the file "livechat.vm".

In the file editor, paste the snippet of LiveChat code into the template click Save and then click Close.

Including LiveChat on every page.

To have LiveChat appear on every one of our pages, we need to include this template within another template that every page uses.  To do this click on the "Templates" tab as shown below.

Now click on "Misc".  This is the folder that all snippets live in.

Scroll down until you find "snippets/document_bottom.vm" and click it.

At the bottom of the file add the following lines and click Save.

Including livechat.vm template
## LiveChat Script
#parse("livechat.vm")

Advanced - Showing chat only on affiliate portal

If you only want to make the chat script available for affiliates, add the following if statement around the parse.

Including livechat.vm template
## LiveChat only on affiliate pages
#if( $pageGroup == 'affiliate' )
  ## LiveChat Script
  #parse("livechat.vm")
#end