• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Google's new call tracking and _googWcmGet function

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › General Discussion › Google's new call tracking and _googWcmGet function

This topic is: not resolved

Tagged: AdWords, call tracking, custom function

  • This topic has 6 replies, 3 voices, and was last updated 8 years, 6 months ago by Webmaster.
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • September 4, 2014 at 4:11 pm #122824
    SelenaD
    Member

    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 #122894
    Brad Dalton
    Participant

    Hook 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>
    

    Tutorials for StudioPress Themes.

    September 5, 2014 at 1:42 pm #122978
    SelenaD
    Member

    Thanks 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 #122992
    Brad Dalton
    Participant

    Yes, you need to add that code in a custom function.

    Or a new widget.


    Tutorials for StudioPress Themes.

    September 5, 2014 at 9:20 pm #123012
    Webmaster
    Member

    Did 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 #123070
    SelenaD
    Member

    No. 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 #123077
    Webmaster
    Member

    Yeah, 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.“

  • Author
    Posts
Viewing 7 posts - 1 through 7 (of 7 total)
  • The forum ‘General Discussion’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2023 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble