• I was wondering if there is a way to add some google analytics code to the related posts listed after each article. I essentially want to see how many people actually use the related posts plugin.

Viewing 1 replies (of 1 total)
  • Yes there is. Just add utm parameters to the template. I use the simple template and this is what it looks like after modification to include UTM parameters

    <?php 
    /*
    Template Name: Simple
    Author: mitcho (Michael Yoshitaka Erlewine)
    Description: A simple example YARPP template.
    */
    ?>
    <?php if (have_posts()):?>
    <ol>
    	<?php while (have_posts()) : the_post(); ?>
    	<li><a href="<?php the_permalink() ?>?utm_source=internal&utm_medium=related_posts&utm_campaign=mobile" rel="bookmark"><?php the_title(); ?></a><!-- (<?php the_score(); ?>)--></li>
    	<?php endwhile; ?>
    </ol>
    <?php else: ?>
    <p>No related posts.</p>
    <?php endif; ?>

    The major change is the utm parameter (?utm_source=internal&utm_medium=related_posts&utm_campaign=mobile) added after php the permalink

Viewing 1 replies (of 1 total)
  • The topic ‘Tracking on Related Posts’ is closed to new replies.