Archived topic
tracking pixel
6 replies · Started by Gary L on August 6, 2018
Hi,
I need to place a tracking pixel on one page only.
The tracking pixel comes in javascript or html
Do I need a GPhook for this or can I put it in the text editor of the page and it will stay there?
Or what is the best way?
Thanks
Hi there,
Does this help?
https://generatepress.com/forums/topic/tracking-pixel-on-one-page/#post-278178
Hi,
I saw that post earlier, I'm not sure how to do a hook for one post only. Isn't the GPhooks under Appearance sitewide? Or does the code from the page you just showed me signify what page the hook goes to?
I looked at the post page I need to place the tracking pixel. I don't see a place to insert a GPhook.
Thanks
Oh, I think I see...where it says page slug here...that would do it, right?
Yup exactly.
More info here: https://docs.generatepress.com/article/using-hooks-conditional-tags/
Thought I should mention that starting in GP premium 1.7 (currently in release candidate 2 so we think it's really stable), the new Hooks element module will replace the need for writing code:
https://docs.generatepress.com/article/hooks-element-overview/#display-rules
You can become a beta tester here:
https://docs.generatepress.com/article/beta-testing/
Hi,
Ok that did the trick, I'll keep it in mind about the new beta when I get a bit more time.
I have another tracking pixel for engagements that goes on 3 other pages, (same pixel)
in the php code 1st line:
php if ( is_page( 'page-slug-here' )
do you seperate by comma or I need to do code for each page slug?
php if ( is_page( '1,2,3' )
Thanks
Please take a look at this page: https://codex.wordpress.org/Conditional_Tags#A_PAGE_Page