Home > How To's/Reviews > Exclude Administrator from Woopra Analytics

Exclude Administrator from Woopra Analytics

Woopra Analytics allows administrators to exclude statistics based on a number of criteria (IP address, user names, etc.) However, for websites with only one administrator, a better approach would be to prevent loading the Woopra javascript (JS) in the first place whenever the admin accesses the site.

For logged in users, WordPress has assigns a value to the $user_ID variable; therefore, you’re interested in serving the Woopra JS to people who do not have this variable defined. Insert the following code into your theme’s footer.php file.

<?php if (!$user_ID) { ?>
<script src="https://static.woopra.com/js/woopra.js" type="text/javascript"></script>
<?php } ?>

 LEGAL

My posts are not to serve as a replacement for recommendations provided by licensed physicians nor do they represent the opinions of Baylor College of Medicine or its affiliated institutions. Please read this site's Disclaimer and Terms of Use for more information.

ALSO CHECK OUT  

410 Entire Directory With .htaccess

Due to an oversight with folder permissions, I was recently the victim of a massive …

 4 comments

  1. Hmmm…apparently, it may have been working all along. I have tagged myself and thus have two instances of “Me” showing up in my stats; “Admin” and “Me.” Perhaps I should not have tested the tagging on myself. However, now that I have, I wonder what happens when you tag other visitors? Does Woopra display stats for that individual using the tag AND their IP? I don’t think this is ideal for the stats. At any rate. My problem is fixed. I pasted your code into my Thesis Openhook plugin (after footer). This allows me to update my theme on a regular basis without having to remember to update every tweak. 😉 It hides the admin, not the tagged (Me) version. I then excluded the tagged “Me” through Woopra and it seems to work now. No more Admin OR Me in the stats. 🙂 Now only if I could get rid of that tag…

    Thanks for your help!

  2. Thank you. I will try it. I don’t know where you find all the time but I really do appreciate your quick response. I had hoped not to mess with the original code but I think it may be the only way. I will let you know if it works. Thanks again. 🙂

  3. Hmmm…this does not seem to work for me. Perhaps you can shed some light? I am using the Thesis theme. It is equipped with a plugin that makes it easy to use what they call hooks to insert code before or after the header, footer, etc. and including inside the footer or the wp_footer. I have tried your code in all places and it does not seem to take hold. Any suggestions? I’ve noticed that the Woopra filters do not allow for “not equal” to, which I think should be included. There is greater than and equal to, less than and equal to, but no does not equal. It seems simple. One could just create a filter that is not equal to “admin” or not equal to a certain IP. Your thoughts?

    • Hey Wendy! I visited your site and found the problem by examining the HTML source. I think the best solution will be to go to your WordPress Dashboard, click on Editor (it’s under Appearance in the left column), open your footer.php file, and then copy and paste the code in the post above your </body> tag. Also, make sure you remove other Woopra plugins and/or footer entries you’ve put in your template. Let me know if this works! 🙂

 DROP A LINE

Your email address will not be published. Required fields are marked *