• Resolved braedenmayer

    (@braedenmayer)


    Hi, I’m using WPCode to add a small tracking script in the header. It works fine globally, but I only want to load it on a few selected pages.

    What’s the best way to do this without adding the code manually to each page?

Viewing 1 replies (of 1 total)
  • Plugin Support markomiljanovic

    (@markomiljanovic)

    Hi @braedenmayer,

    The best way to do this is to move the script into its own snippet since Header & Footer always loads site-wide. You’d create a new snippet at Code Snippets > + Add Snippet, and choose HTML as the code type so it outputs exactly as-is and paste the tracking script in.

    Under Insertion, set the Auto Insert location to “Site Wide Header“. Then scroll down to Smart Conditional Logic, toggle it on, set the conditional logic type to “Show,” and add a rule group matching the pages you want, for reference, please check the following screenshot: https://quicksnip.com/s/wk86t3s90t2f12k.

    Once saved and activated, the snippet will only output in the header on the pages matching your rules, and nowhere else. You can find a full walkthrough here: https://wpcode.com/how-to-add-scripts-to-specific-pages-in-wordpress/

    Let me know if you run into any issues setting it up.

    Thanks,

Viewing 1 replies (of 1 total)

You must be logged in to reply to this topic.