Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1105777

    thelistener
    Participant

    Hola,
    Here’s the link to the site I’m working on.

    Here’s the code that I’ve got in the header (using the Header and Footer Scripts WordPress plugin):

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

    Here’s the code in the footer:

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

    Now I am being told that I have to add a second piece of JavaScript code to using the _googWcmGet() function with these parameters:

    _googWcmGet(target, business_number, options)

    I’m supposed to add it between the body tags. I am at a loss on this part.
    BTW, I am thankfully using a child theme. Any and all help is appreciated.

    #1106005

    Darshana
    Moderator

    Hi there,

    Thanks for writing in! Please check the following example post on how to integrate an external javascript code (https://community.theme.co/forums/topic/google-analytics-18/#post-1098591).

    Hope that helps.

    #1109273

    thelistener
    Participant

    I’m sorry but the code in that post is for Google Analytics. I’m trying to get their adwords call tracking code working. What do I need to do?

    #1109537

    Darshana
    Moderator

    Hi there,

    You just need to follow the example and replace with your code. Add the following code into your child theme’s functions.php file.

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

    To add the code into your footer, add the following code (basically place it below the above code).

    
    add_action('wp_footer', 'my_adowrds_footer');
    function my_adowrds_footer() {
    echo "<script type='text/javascript'>
    var google_replace_number='(888) 280 - 4878';
    (function(a,e,c,f,g,b,d){var h={ak:'968921182',cl:'bM8tCKj_52UQ3qCCzgM'};a[c]=a[c]||function(){(a[c].q=a[c].q||[]).push(arguments)};a[f]||(a[f]=h.ak);b=e.createElement(g);b.async=1;b.src='//www.gstatic.com/wcm/loader.js';d=e.getElementsByTagName(g)[0];d.parentNode.insertBefore(b,d);a._googWcmGet=function(b,d,e){a[c](2,b,h,d,null,new Date,e)}})(window,document,'_googWcmImpl','_googWcmAk','script');
    </script>";
    }
    

    Hope that helps.

    #1110233

    thelistener
    Participant

    ok, the code has been added, but the google forwarding number doesn’t appear to be showing up. what am i missing? also, do i remove the code in my first post above from the header/footer plugin?

    #1110522

    Rad
    Moderator

    Hi there,

    Yes, you’ll have to remove them.

    It may not take effect in real time. Would you mind providing a procedure on how we could see the issue? Perhaps it’s the call icon on google index page ?

    https://storage.googleapis.com/support-kms-prod/FDFFABC9B25083FB5B1666FFEEAA59CC7B23

    Thanks!

    #1111141

    thelistener
    Participant
    This reply has been marked as private.
    #1111428

    Lely
    Moderator

    Hi There,

    1.) From this #1109537 reply above, just add the first set of code on your functions.php file.

    2.) Then remove the second code suggested from this reply #1109537.
    Then you may add the next line of code on Appearance > Customize > Custom > Edit Global Javascript:

    _googWcmGet('number', '1-888-280-4878')

    The number of that line of code is your target parameter. We need to add it on your phonenumber class field. Go to Appearance > Customize > Header > Topbar Content
    Update the following line of code:
    <a href="tel:+18882804878">Call Us: (888) 280 - 4878</a>
    To this:
    <a href="tel:+18882804878" class="number">Call Us: (888) 280 - 4878</a>

    Hope this helps.

    #1112431

    thelistener
    Participant

    Thank you…I’ll let you know if it works:-)

    #1112449

    Rahul
    Moderator

    You’re welcome!

    Awaiting for your response.