Magento Live Chat HTML Code

From Chatstack v5.1, we officially support adding the live chat HTML code within Magento stores. You can follow the steps below to easily get started using Chatstack.

Step 1 – Chatstack Server Installation

Before you can add the HTML code to your Magento website (at http://www.example.com/livehelp/) you will need to complete the Chatstack server software installation. These instructions can be found at Documentation – Server Software Installation Instructions. Once you have completed the server software installation and successfully logged into the Chatstack administration you can add the live chat HTML code to your Magento store.

Step 2 – Magento HTML Code Installation

The following lines should be added within your Magento head.phtml template file. You can locate this template file at /app/design/frontend/{package}/{theme}/template/page/html/head.phtml where {package} is your configured Magento template package and {theme} is your custom Magento theme.

If you are unsure what package and template that you have configured then you can check this within the Magento administration under System > Configuration. Once you have opened this section you should navigate to Configuration > General > Design. Within the design settings, you can locate the package and template name that is configured.

This code should be placed after the other <script> tags but before the </head> tag within the header.phtml file:

<!--  BEGIN chatstack.com Live Chat HTML Code //-->
<script type="text/javascript">
    var LiveHelpSettings = {};
    LiveHelpSettings.server = '<?php echo(preg_replace('#^https?://|/$#', '', Mage::getBaseUrl())); ?>';
    LiveHelpSettings.embedded = true;
    (function(d, undefined) { 
        // JavaScript
        var LiveHelp = d.createElement('script'); LiveHelp.type = 'text/javascript'; LiveHelp.async = true;
        LiveHelp.src = ('https:' == d.location.protocol ? 'https://' : 'http://') + LiveHelpSettings.server + '/livehelp/scripts/js.min.js';
        var s = d.getElementsByTagName('script')[0];
        s.parentNode.insertBefore(LiveHelp, s);
    })(document);
</script>
<!--  END chatstack.com Live Chat HTML Code //-->

If you don’t see the live chat tab on your store after adding the above code then you may need to clear the Magento cache at System > Cache Management > Flush Magento Cache.

Need Help?

If you experience any issues with the above instructions or require our assistance then please contact us via. email or live chat for help.