0
How to set up Google Analytics Code to prevent administrators' or authors' access to Wordpress administrative areas from being counted?
0
How to set up Google Analytics Code to prevent administrators' or authors' access to Wordpress administrative areas from being counted?
0
If you want to do it in hand, here it goes:
Install the plugin https://br.wordpress.org/plugins/header-footer/
Enter in the Footer tab:
<? if (!is_user_logged_in()) { ?>
<script type="text/javascript">
...GOOGLE ANALYTICS CODE...
<? } ?>
Leonel, to understand: the command <? (!is_user_logged_in()) { ? > is a php that denies reading Google-Analytics if the "user" is logged in to the admin panel. That’s it?
Exact @Edmarrobertoprandini!
Just so you know, your suggestion didn’t work.
You still need a hand with that? Try to validate whether or not you are calling with the Chrome extension: https://chrome.google.com/webstore/detail/google-analytics-debugger/jnkmfdileelhofjcijamephohjechhna
Actually, I partially solved it by creating a filter for /wp-admin/ in the GA administration. But, pages visited by administrators outside of wp-admin will be logged, which I intended would not be calculated.
You can add the Google tag by your footer.php: <? php if ( !is_user_logged_in()) { ? > <script type="text/javascript"> GA code </script> <?php } ? > Reference: https://www.doitwithwp.com/exclude-admins-from-google-analytics-on-wordpress/
0
Most likely the plugin you use already has this option. I use Yoast SEO, considered one of the best on the market, and it already has this option to prevent count of administrators.
Where? How to configure?
Which plugin do you use? I just wanted to make a correction that Yoast Analytics became Monster Insights Analytics. To edit you access the menu in the left sidebar in this sequence. Insights > Settings > Tracking > Ignore These user roles from tracking: Here you can add positions you don’t want to be counted. Using Monster Insights Analytics, old Yoast Analytics.
Browser other questions tagged wordpress google-analytics
You are not signed in. Login or sign up in order to post.
how did you install the code? Using a plugin? Pasting the script into the pages?
– Ricardo Moraleida
I use a plugin
– Edmar Roberto Prandini
Your plugin should have an admin page where you select whether or not to track the admin pages/actions. No more details is all I can tell you.
– Ricardo Moraleida
But my intention is to do this in javascript code. Because then, I am not in the plugin dependency.
– Edmar Roberto Prandini