2

I'm trying to add the following code to my templates index.php, but each time I add the code I break the site.

<script type="text/javascript">
  window.$zopim||(function(d,s){var z=$zopim=function(c){z._.push(c)},$=z.s=
  d.createElement(s),e=d.getElementsByTagName(s)[0];z.set=function(o){z.set.
  _.push(o)};z._=[];z.set._=[];$.async=!0;$.setAttribute("charset","utf-8");
  $.src="//v2.zopim.com/?3I3JjfOxszMie8h425NCRI4SIES4vmiO";z.t=+new Date;$.
  type="text/javascript";e.parentNode.insertBefore($,e)})(document,"script");
</script>

The name of the site that I'm getting the code from is Zopim - its a Live Chat site.

1

From your previous question I know you're using the Gavick framework. The index.php file is somewhat different from other templates, it loads all the parts of your website from other files.

The correct file to edit is templates/YOURTEMPLATE/layouts/blocks/head.php. Past your code at the end of this file and you should be good to go.

Another option is to use a Custom HTML module (e.g. Custom HTML Advanced) to paste your code and publish the module to the pages where you want your live chat code to appear.

| improve this answer | |
  • Hello John, thanks again for responding . Going to try your suggestions now. I'll let you know how I get on. Cheers – cpatte7372 Sep 4 '15 at 10:06
  • No problem, I'm glad it worked. (name's still Johan, though...:) – johanpw Sep 5 '15 at 15:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.