Tagged: x
-
AuthorPosts
-
February 2, 2017 at 7:44 pm #1356063
Michael RParticipantHello,
I need to place a tracking code on my site but the code cannot be placed within the <head> </head> tags of the page.I found another question similar to mine about adding a tracking code to the theme’s footer.php file.
The answer given was to add the code below to the functions.php file:
add_action(‘wp_footer’, ‘my_tracking_code’, 9999);
function my_tracking_code() { ?>
<!–replace this line with your tracking code–>
<?php }
However, when I create a page using the template “No Container – No Header, No Footer” this code does not populate. How can I add the tracking code to all pages so that it will appear even if I use a template with No Footer, No Header without putting it in the <head> tags?
Thank you.
February 2, 2017 at 7:45 pm #1356069
Michael RParticipantThis reply has been marked as private.February 3, 2017 at 12:23 am #1356350
RupokMemberHi there,
Thanks for writing in! You can follow this thread to add code to footer – https://community.theme.co/forums/topic/need-to-add-google-number-script-to-the-footer/#post-908572
And this to use within header – https://community.theme.co/forums/topic/add-tracking-code-to-header/#post-776299
Cheers!
February 3, 2017 at 12:48 pm #1357058
Michael RParticipantThis reply has been marked as private.February 3, 2017 at 8:47 pm #1357545
FriechModeratorHi There,
It does not really matter what page template you’re using, as long as your template follows the standard structure of an HTML document. That given code will always output immediately before the
</body>tag.add_action('wp_footer', 'my_custom_footer_script', 9999); function my_custom_footer_script() { ?> <!-- TraCKING CODE HERE --> <?php }Maybe it was your caching did not re-generate, the first time you test this code on a No footer template. Make sure to always clear your caching plugin and your browser’s cache.
Thanks.
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1356063 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
