Skip to content

Instantly share code, notes, and snippets.

@jonschr
Last active October 22, 2015 19:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonschr/c4149173b65fddd8bf46 to your computer and use it in GitHub Desktop.
Save jonschr/c4149173b65fddd8bf46 to your computer and use it in GitHub Desktop.
<?php
// Don't include the opening php tag
// Add a tracking script to a particular page, just before the </body> tag
add_action( 'wp_footer', 'tj_add_tracking_scripts' );
function tj_add_tracking_scripts() {
global $post;
if ( is_page( 'your-page-slug' ) ) {
?>
PASTE YOUR SCRIPT HERE
<?php
}
if ( is_page( 'your-second-page-slug' ) ) {
?>
PASTE YOUR SECOND SCRIPT HERE
<?php
}
if ( is_page( 'your-third-page-slug' ) ) {
?>
PASTE YOUR THIRD SCRIPT HERE
<?php
}
if ( is_page( 'your-fourth-page-slug' ) ) {
?>
PASTE YOUR OTHER SCRIPT HERE
<?php
}
if ( is_page( 'your-fifth-page-slug' ) ) {
?>
PASTE YOUR FIFTH SCRIPT HERE
<?php
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment