FunnelKit
FunnelKit Documentation
Get unstuck with our helpful reference material

Funnel Builder

Disable Purchase Event Tracking for a Specific User Role

This document outlines how to disable purchase event tracking for a specific user role in FunnelKit. You can achieve this by using a custom code snippet.

This guide will walk you through the steps to implement the snippet either through your child theme's functions.php file or by using the Code Snippets plugin.

Steps to Disable Purchase Event Tracking For Specific User Roles

Step 1: Access the Custom Code Snippet

To disable event tracking for a specific user role, use the following code snippet:

class BWF_Funnel_Temp_150320222 {
	public function __construct() {
		add_filter( 'wfocu_front_ecomm_tracking', [ $this, 'wffn_check' ] );
		add_filter( 'wfacp_do_tracking', [ $this, 'wffn_check' ] );
		add_filter( 'wfacp_css_js_deque', [ $this, 'wffn_check' ], 10 );
		add_filter( 'wffn_allow_tracking', [ $this, 'wffn_check' ], 1, 10 );
		add_filter( 'wffn_allow_site_wide_tracking', [ $this, 'wffn_check' ], 1, 10 );
	}

	function wffn_check( $should_render ) {
		if ( current_user_can( 'administrator' ) || current_user_can( 'shop_manager' ) || current_user_can( 'editor' ) ) {
			$should_render = false;

		}

		return $should_render;
	}


}

new BWF_Funnel_Temp_150320222();

Step 2: Add the code snippet

You can add the snippet directly to your theme’s functions.php file. Alternatively, you can use the Code Snippets plugin for easier code management.

Step 3: Define User Role in the Snippet

In the code snippet, you can specify the user role for which you do not wish to track events.

User Role Example

Step 4: Add the Code to Your Site

After defining the user role, add the snippet either to your functions.php file or through the Code Snippets plugin to activate the changes.

Conclusion

By following these steps, you can disable purchase event tracking for specific user roles in FunnelKit.

Ready to Transform Your Store?
Join 38,315+ successful store owners who trust FunnelKit to power their businesses.
Conversion Optimized Checkout Pages
Increase Revenue with Smart Upsells
Capture Emails & Recover Abandoned Carts
Automate Winbacks & Repeat Sales
918+ 5 star reviews on WordPress.org
Transform your store to power your business with FunnelKit
🚀 Maximize Your Profit with FunnelKit – Highest Rated with 918+ 5-Star Reviews
Get Started