• 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 Tag Manager in Simple Hooks

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 › Design Tips and Tricks › Google Tag Manager in Simple Hooks

This topic is: not resolved
  • This topic has 2 replies, 2 voices, and was last updated 9 years ago by sunshiner.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • January 19, 2017 at 11:34 am #199673
    sunshiner
    Member

    Hi! I've been using Genesis for a long time but just learning about analytics. I'm trying to use the Genesis Simple Hooks plugin to add Google Tag Manager to my site. They want me to paste code in two places, instructions as follows:

    #1 Paste this code as high in the <head> of the page as possible:

    #2 Additionally, paste this code immediately after the opening <body> tag:

    For #2, I've put the code in Genesis_Before, but I have no idea where to put the code for #1.

    Can anyone help? Thanks in advance, I'm so grateful 🙂

    Karen

    January 19, 2017 at 11:54 am #199674
    Victor Font
    Moderator

    Because of the instruction to place as high in the head section as possible, I wouldn't use Genesis Simple Hooks. The wp_head hook is going to place the code at the bottom of head area before the closing tag. To get the code near the top, you need to use a hook that's executed at the beginning of the page load like genesis_doctype or genesis_meta. genesis_doctype will give you the highest position. You would need to add something like this to functions.php:

    add_action( 'genesis_doctype', 'add_google_tag_manager_script', 12 );
    function add_google_tag_manager_script() {
    ?>
    insert your script here....
    <?php
    }

    Regards,

    Victor
    https://victorfont.com/
    Call us toll free: 844-VIC-FONT (842-3668)
    Have you requested your free website audit yet?

    January 19, 2017 at 1:03 pm #199688
    sunshiner
    Member

    Thanks Victor, much appreciated. I'm not yet comfortable doing that so I'll have to figure it out.
    Thanks! 🙂

  • Author
    Posts
Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘Design Tips and Tricks’ 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

© 2026 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