Google tracking pixel on specific page

Hi,
I need to put a google tracking pixel on a specific page on the the acamuseum.ca site

Google give me apiece of code for the header and some for the body,

I was going to use this:

function custom_code(){
if ( is_page( 1122 )) {
?>
CODE HERE
<?php
}
}
add_action(‘wp_footer’, ‘custom_code’);

then changing ‘wp_footer’ to "wp_head’

For the body code do I add another function for the body like this

function custom_code(){
if ( is_page( 1122 )) {
?>
CODE HERE
<?php
}
}
add_action(‘wp_body’, ‘custom_code’);

or is the code different?

Appreciate any advice you may have,
Mike

Hi Mike,

Thanks for writing in! The wp_head and wp_footer functions correct.

If you want to add a code after body tag, use x_before_site_begin. You can see some examples from the following link (https://theme.co/apex/forum/t/customizations-actions-and-filters-in-x-pro/208).

Hope that helps.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.