Disable Google Analytics for logged in users

In case you’re using Google Analytics for website metrics, you probably only want to track real visitors, and not authors and writers.

This snippet automatically adds the Google Analytics code to your footer area (in case “wp_footer()” is called), so you don’t have to manually insert the Analytics code to all your files.

Place this snippet in your functions.php file located in your theme’s directory. If there’s no functions.php, create one. You have to insert your Google Analytics id at “XXXXXXXX“. Have fun with it!

Comments  Leave a Reply

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

WordPress Launch Checklist

The Ultimate WordPress Launch Checklist

We've compiled all the essential checklist items for your next WordPress website launch into one handy ebook.
Yes, Send Me the Free eBook!