Du musst dich anmelden um Beiträge und Themen zu erstellen. Einloggen · Registrieren

Prevent Google Analytics from Tracking Admin Pages

This handy snippet will prevent Google Analytics from tracking your Admin pages or anything else that you wish. Replace your default Google Analytics code with the following:

<?php if (!current_user_can('level_10')) { ?>

	/* Google Analytics Code */

<?php } ?>

This code will then include your Google Analytics code only on non-Admin pages. This in turn will prevent Google Analytics from gathering statistics about your Admin pages. Note that the basic functionality of this method is great for restricting just about anything — scripts, markup, content — to logged-in administrators.