JS code

Quick question i need to add the following 2 pieces of code to a website and i want to make sure ive added these to the correct place as ive not done this before.

js code - added to custom js box in theme options

<script type="text/javascript">
(function(a,e,c,f,g,h,b,d){var k={ak:"874436278",cl:"Ad6RCJi3-WoQtq37oAM"};a[c]=a[c]||function(){(a[c].q=a[c].q||[]).push(arguments)};a[g]||(a[g]=k.ak);b=e.createElement(h);b.async=1;b.src="//www.gstatic.com/wcm/loader.js";d=e.getElementsByTagName(h)[0];d.parentNode.insertBefore(b,d);a[f]=function(b,d,e){a[c](2,b,k,d,null,new Date,e)};a[f]()})(window,document,"_googWcmImpl","_googWcmGet","_googWcmAk","script");
</script>

Next piece of code is the one im unsure of, do i add this to the same section (custom js box) or do i add it to the custom css box

<body onload="_googWcmGet('number', '0800 321 3309')">
          <span class="number">0800 321 3309</span>
        </body>

Many Thanks

Comments

  • Hi,

    the 2nd piece of code need to be added in the content because it's html. So you can add it into Column item or any other place where html tags are allowed.
  • so where can i put this code, if i put it in a column its going to be visible on the website. I need both these codes on the website so that they change the normal telephone number to google forwarding number im really unsure of where to put these. currently got them both in the js code - added to custom js box in theme options

    <script type="text/javascript">
    (function(a,e,c,f,g,h,b,d){var k={ak:"874436278",cl:"Ad6RCJi3-WoQtq37oAM"};a[c]=a[c]||function(){(a[c].q=a[c].q||[]).push(arguments)};a[g]||(a[g]=k.ak);b=e.createElement(h);b.async=1;b.src="//www.gstatic.com/wcm/loader.js";d=e.getElementsByTagName(h)[0];d.parentNode.insertBefore(b,d);a[f]=function(b,d,e){a[c](2,b,k,d,null,new Date,e)};a[f]()})(window,document,"_googWcmImpl","_googWcmGet","_googWcmAk","script");
    </script>

    <body onload="_googWcmGet('number', '0800 321 3309')">
              <span class="number">0800 321 3309</span>
            </body>
  • i need to add the first code between <head></head> 
  • To add the code that need to be put between <head> and </head> you need to do necessary modification inside header.php file.
Sign In or Register to comment.