Tagged: x
-
AuthorPosts
-
July 27, 2016 at 2:45 pm #1105777
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.July 27, 2016 at 5:32 pm #1106005Hi 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.
July 29, 2016 at 2:47 pm #1109273I’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?
July 29, 2016 at 6:55 pm #1109537Hi 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.
July 30, 2016 at 11:37 am #1110233ok, 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?
July 30, 2016 at 7:46 pm #1110522Hi 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 ?
Thanks!
July 31, 2016 at 2:26 pm #1111141This reply has been marked as private.July 31, 2016 at 8:48 pm #1111428Hi 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.
August 1, 2016 at 1:25 pm #1112431Thank you…I’ll let you know if it works:-)
August 1, 2016 at 1:37 pm #1112449You’re welcome!
Awaiting for your response.
-
AuthorPosts