• 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

Where to drop Tracking Pixels for the Homepage

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 › Where to drop Tracking Pixels for the Homepage

This topic is: not resolved

Tagged: front page, tracking codes

  • This topic has 6 replies, 3 voices, and was last updated 5 years, 8 months ago by Brad Dalton.
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • May 17, 2017 at 10:04 am #206598
    BlakeN
    Participant

    Where is the best place to drop tracking pixels for the homepage. I do not want them on every page of the site so please do not suggest the header section on the genesis theme settings.

    I need to drop a code on only the homepage but frontpage.php did not seem to be the right place.

    I need to drop the a tracking script for multiple pages.

    <script>
    fbq('track', 'ViewContent');
    </script>

    Any help is greatly appreciated.

    http://www.barrgo.com/
    May 17, 2017 at 10:17 am #206601
    Victor Font
    Moderator

    The best place is still the header, but you would wrap your code in a WordPress conditional so it only appears on the home page. https://codex.wordpress.org/Conditional_Tags


    Regards,

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

    May 17, 2017 at 10:53 am #206603
    BlakeN
    Participant

    Thanks Victor that is perfect.

    May 17, 2017 at 11:43 am #206604
    BlakeN
    Participant

    I did want to clarify that the same rules still apply for the genesis framework and child themes.

    If I wanted to drop my tracking code on only the front page then:

    is_front_page(<script>
    fbq('track', 'ViewContent');
    </script> )

    May 17, 2017 at 12:20 pm #206606
    BlakeN
    Participant

    I believe you may be incorrect. I've read over the following directly from the tracking page:

    If a person is taken to a new page as a result of the action, you should set up the event to be sent on page load. Ex: After a purchase a person is taken to an order confirmation page.
    To send events on page load, add the event code (between <script> tags) just below the </head> tag. This allows the event code to load along with the pixel base code when the page loads.
    Notice
    Be sure not to insert the event code inside the <head> tags.

    May 17, 2017 at 1:50 pm #206612
    Victor Font
    Moderator

    That's not how to use is_front_page. The WordPress functions are PHP. You have to create a PHP function and apply it through a WordPress or Genesis filter. Even if you were to use jQuery document onload, to get it on the front page only, you still need to create a PHP function to load the script conditionally.


    Regards,

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

    May 17, 2017 at 6:14 pm #206638
    Brad Dalton
    Participant

    Or you can load the script directly from your front-page.php file without a conditional tag.


    Get Help – Book Consultation.

  • 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