Skip to main content
Cookbook Marketing GTM4WP

Stop Tracking Your Own Visits in Google Tag Manager with GTM4WP and AI

Your own and your team's logged-in visits kept out of Google Tag Manager, by role, after your yes.

Difficulty Beginner
Time ~5 min

Prerequisites

A site connected to WPVibe running GTM4WP (Google Tag Manager for WordPress) 2.1 or newer (tested on 2.1.1, free) on WordPress 6.9 or newer (tested on 7.1.4), with an administrator account.

The prompt
My WordPress site uses GTM4WP (Google Tag Manager for WordPress). Stop Google Tag Manager loading when my team and I are logged in, so our own visits are not tracked. [Optional: the roles to exclude, for example administrators and editors.]

1. Run discover_abilities with category gtm4wp. If no gtm4wp ability is there, stop and tell me to install or update the free GTM4WP plugin (Google Tag Manager for WordPress, 2.1 or newer, on WordPress 6.9 or newer), or that the site may have switched GTM4WP's abilities off. If the others are there but gtm4wp/update-settings is not, tell me this site keeps GTM4WP's abilities read-only, so the change is made on the GTM4WP settings screen, and stop.
2. Run gtm4wp/get-settings with keys gtm-no-gtm-for-logged-in and include_schema true, and keep its values_hash. The field's choices are the roles on my site, and its value lists the roles already excluded, comma separated. Show me the roles already excluded, then the other roles. If I named roles, match them to these. If not, suggest the staff roles among them (such as administrator, editor, author, shop_manager) and ask which to exclude. Do not suggest customer, subscriber or any role for members, students or donors: those are real visitors. If I name one, tell me their visits, and on a store their purchases while logged in, will no longer be tracked, and ask me again.
3. Run gtm4wp/export-settings and keep its answer as the backup of my settings: to undo, send the old values from it with gtm4wp/update-settings after the same confirmation, never with import-settings, which replaces every setting. Show me each option you will change with its current value and its new value, and ask: Confirm this change? Wait for my yes. Then run gtm4wp/update-settings with only those options under values, and expected_hash set to the values_hash from get-settings. If it says the settings changed in between, read them again and ask me again. If it says changing settings through the Abilities API is switched off, tell me to change it on the GTM4WP settings screen and stop. If it lists an option under errors, tell me its message: that option was not saved. Send gtm-no-gtm-for-logged-in as the whole list: every role already excluded that I keep, plus the new ones, as a list of role slugs.
4. Run gtm4wp/get-site-health and confirm the row Container disabled for roles lists exactly those roles.
5. Tell me the container no longer loads for those roles while logged in, and the data layer is still written. Tell me that logged out, or in a private window, I count as a visitor again, and that this is how to use Tag Manager's Preview mode on my site from now on.
Already connected?

Skip pasting the full prompt. Drop this into your AI on a site that already has WPVibe:

Run the “Stop Tracking Your Own Visits in Google Tag Manager with GTM4WP and AI” recipe from the WPVibe cookbook on my connected site.

Every time you or your team check a page, edit a product or test the checkout, it counts as a visit in Google Analytics and fires your ad pixels. On a small site your own clicks can be a good share of the traffic, and they skew everything from bounce rate to conversions.

GTM4WP can switch the container off for logged-in users with the roles you pick. The AI shows you the roles on your site, suggests the staff ones, and saves the list after your yes, keeping any roles already excluded. Customers and subscribers stay tracked unless you name them, since they are real visitors.

The container stops loading for those roles while they are logged in: both parts of it, so no tag fires. The data layer is still written. Logged out, or in a private window, you count as a visitor again, which is also how to use Tag Manager’s Preview mode on your site afterwards.

Outcome

The Tag Manager container no longer loads for the staff roles you chose while they are logged in.