Forums

exclude analytics code if admin is logged in (3 posts)

  1. barelief
    Member
    Posted 3 years ago #

    Hi,
    could you help me to exclude the code of google analytics if admin or some users who write the blog are curretly logged in and browse the site.

    Thanks,
    bart.

  2. barelief
    Member
    Posted 3 years ago #

    sorry 4 my laziness, scanned codex, and here is the solution

    <?php
    global $userdata;
    get_currentuserinfo();
    if ($userdata->user_login!="admin"):
    print "<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
    </script>
    <script type="text/javascript">
    _uacct = "UA-42393-3";
    urchinTracker();
    </script>";
    endif;
    ?>

    http://codex.wordpress.org/get_currentuserinfo

  3. moshu
    Member
    Posted 3 years ago #

    Thank you for posting back the solution!

Topic Closed

This topic has been closed to new replies.

About this Topic