Post previews affecting stats
-
Hi guys,
I’m a WordPress newbie and loving it.
I’ve got a question though. I notice post previews are affecting my web stats (Performancing). Today I saved a draft entry and as usual the write page shows me a preview although the post has not been published yet. Later when I checked my stats I noticed that my draft entry registered a page view.
Is there some way I can hide the stats code so that it does not show up in the previews? A conditional tag or something? Like I said, I’m new.
Here’s the code I stuck into my template. It’s placed right before the
</body>
tag.
<script type="text/javascript">
<?php
global $userdata;
if ($userdata) {
echo "z_user_name=\"" . $userdata->display_name . "\";\n";
echo "z_user_email=\"" . $userdata->user_email . "\";\n";
}
?>
z_post_title="<?php the_title();?>";
z_post_category="<?php $c=get_the_category();echo $c[0]->cat_name;?>";
</script>
<script id="stats_script" type="text/javascript" src="https://metrics.performancing.com/wp.js"></script>
Appreciate all your advice, thanks!
- The topic ‘Post previews affecting stats’ is closed to new replies.