Community Forums › Forums › Archived Forums › General Discussion › Google's new call tracking and _googWcmGet function
Tagged: AdWords, call tracking, custom function
- This topic has 6 replies, 3 voices, and was last updated 10 years, 4 months ago by Webmaster.
-
AuthorPosts
-
September 4, 2014 at 4:11 pm #122824SelenaDMember
Google has added call tracking to adwords, but I'm having trouble figuring out how to use the _googWcmGet function part of this. Rather than paste all of Google's somewhat confusing instructions, I'll refer you to Step 2 #3 on this page: https://support.google.com/adwords/answer/1722054?hl=en#calls_from_websites
I know how to add the first snippet to the head section, but I'm not sure I follow how to do the "<body onload> part. Ihave gone ahead and given all phone numbers a "tel" class so I have a way to target them. Now what?
Is this something I can do in some of the Genesis settings, or do I need add it to my functions.php file, and if so, how?
Thank you for any help you guys can provide!
http://www.cohenlawdenver.com/September 5, 2014 at 2:06 am #122894Brad DaltonParticipantHook either of these 2 examples in using a custom function with genesis hook
Add the second code snippet within the body of your page. The examples below show how to implement this code snippet in two different use cases. Example Get a telephone number and replace contents of all spans of the given class. In this example, the phone number "1-800-123-4567" inside the span tag will be replaced with the formatted forwarding number: <body onload="_googWcmGet('number', '1-800-123-4567')"> <span class="number">1-800-123-4567</span> </body> Example Get a telephone number and send it to a callback function. The example callback function will replace contents of an element with the id "number" with the formatted forwarding number. <head> <script type="text/javascript"> var callback = function(formatted_number, unformatted_number ) { // formatted_number: number to display, in same formatting as number // passed to _googWcmGet(). e.g '1-800-444-5555' in this case // unformatted_number: number to display without any formatting. e.g. // '18004445555' var e = document.getElementById("number"); e.innerHTML = "" e.appendChild(document.createTextNode(formatted_number)); }; </script> </head> <body onload="_googWcmGet(callback, '1-800-123-4567')"> <span id="number">1-800-123-4567</span> </body>
September 5, 2014 at 1:42 pm #122978SelenaDMemberThanks Brad - those are the directions I read on the Google site. What I need to know is how to incorporate that into my functions.php file?
September 5, 2014 at 3:07 pm #122992Brad DaltonParticipantSeptember 5, 2014 at 9:20 pm #123012WebmasterMemberDid that help Selena?
Do you have any more idea about what to do than when you posted?
“If it works, mark the post as [Resolved] so others will feel comfortable trying the solution on their website.“
September 6, 2014 at 12:14 pm #123070SelenaDMemberNo. I know I need a custom function in functions.php. But I still don't know how to write it, or which example to use.
September 6, 2014 at 1:24 pm #123077WebmasterMemberYeah, well it's a bit deeper down the rabbit hole than I usually wander. Genesis take it out; Genesis put something else back in... I haven't grasp it yet. That being said, I have found great use for the Genesis - Simple Hooks plugin as a way to put things where they go without knowing how to get there. For instance the plugin has a "wp_footer Hook" that boasts "This hook executes immediately before the closing </body> tag." It allows php and shortcodes, so there's a way into the body.
Still, in order to modify the body tag itself, you'd have to maybe use the "wp_head Hook", which extols "This hook executes immediately before the closing </head> tag." So seems like you could get in there with a script or something. Anyway, I'd spent some time on Google - surely someone else is now, or has recently been on your same mission.
gLuck
“If it works, mark the post as [Resolved] so others will feel comfortable trying the solution on their website.“
-
AuthorPosts
- The forum ‘General Discussion’ is closed to new topics and replies.