Skip to content

Instantly share code, notes, and snippets.

@jonschr

jonschr/functions.php

Last active Oct 22, 2015
Embed
What would you like to do?
<?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