Exclude admin(WordPress) users from being tracked using Google Tag Manager Without Any Plugins
Recently I received a request from one of client they want exclude WordPress admin traffic using Google Tag Manager without any plugins on WordPress Back-end.
They said, they know few plugin in WordPress, does not want to use because its fully customized web site and Also large website so many bloggers updating content at the same time on the WordPress.
Why Should Exclude WordPress Admin Traffic From Google Analytics using Google Tag Manager without any Plugins and using Data Layer Placing Directly on the WordPress Back-end using Google Tag Manager.
They have already tried solution these solutions in WordPress to Exclude/Block Traffic in Google Analytic
- Blocking IP Address Excluding WordPress Admin Traffic – Using filters in WordPress Admin or Apply filter in Google Analytic, it fails when large number admin users access at the same time. and also users are using dynamic IP address.
2. Dummy Cookie Concept – The cookie concept fails some country due laws of a cookie and also if some body disable cookie on there system, in that case solution is also fails
Then I have decided to write a data Layer to exuding Admin traffic of WordPress using Google Tag Manager without any Plugins, Its took my time to find a solution and finally ended with solution of Excluding of Admin Traffic of WordPress using Google Tag Manager.
Step 1. First Install Google Tag Manager on Your Website /Store
Copy the code below and paste it onto every page of your website. Place it immediately after the opening <body> tag.
<!– Google Tag Manager –>
height=”0″ width=”0″ style=”display:none;visibility:hidden”></iframe></noscript>
new Date().getTime(),event:’gtm.js’});var f=d.getElementsByTagName(s),
<!– End Google Tag Manager –>
Note: Make you will replace GTM Tracking Code with your GTM ID
Step 2. Place DataLayer Code Place on functions.php in WordPress Back-end exclude to admin Traffic.
Step 3. Create a Data Layer Variable to Track admin users to State “Logged-In” and “Logged-out” using without any plugin of WordPress
Step 4. It’s time be Test the result using Google Tag Manager
When Login WordPress Back-end
When Login out WordPress Back-end
Step 5. It’s time check Result with Google Analytic and Implement Trigger in Google Tag Manager
For Contact: email@example.com
Disclaimer: Google tag manager belongs to Google propertyNo Fields Found.