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.
This website uses cookies

We use cookies to personalise content and ads, to provide social media features and to analyse our traffic. We also share information about your use of our site with our social media, advertising and analytics partners who may combine it with other information that you’ve provided to them or that they’ve collected from your use of their services.

Cookies are small text files that can be used by websites to make a user's experience more efficient.

The law states that we can store cookies on your device if they are strictly necessary for the operation of this site. For all other types of cookies we need your permission. This means that cookies which are categorized as necessary, are processed based on GDPR Art. 6 (1) (f). All other cookies, meaning those from the categories preferences and marketing, are processed based on GDPR Art. 6 (1) (a) GDPR.

This site uses different types of cookies. Some cookies are placed by third party services that appear on our pages.

You can at any time change or withdraw your consent from the Cookie Declaration on our website.

Learn more about who we are, how you can contact us and how we process personal data in our Privacy Policy.

Please state your consent ID and date when you contact us regarding your consent.