For developers who need to customize tracking beyond the Add On settings, the Google Analytics Integration Add On offers several filter hooks. Use them to stop tracking in specific cases, support cookie consent tools, and add your own event parameters or user properties.

Filters

pmproga4_dont_track

Determines whether to stop tracking on the current page load. Return true to prevent the Google Analytics tag and all events from loading. Use this to skip tracking for specific users, roles, or pages.

apply_filters( 'pmproga4_dont_track', bool $stop_tracking );

Parameters

  • $stop_tracking: bool; Whether to stop tracking. Default false.

pmproga4_script_atts

Filters the attributes added to the inline <script> tag that configures Google Analytics. Use this to add the attributes a cookie consent plugin needs to block or allow the script.

apply_filters( 'pmproga4_script_atts', string $script_atts );

Parameters

  • $script_atts: string; Attributes for the script tag, such as type="text/plain". Default empty string.

pmproga4_track_view_item_event

Determines whether to send the view_item event on the current page. By default, the event is only sent on the Membership Levels page. Return true to send it on another page, such as a custom pricing page.

apply_filters( 'pmproga4_track_view_item_event', bool $track_view_item_event );

Parameters

  • $track_view_item_event: bool; Whether to send the view_item event. Default is true on the Membership Levels page and false elsewhere.

pmproga4_track_level_ids

Filters the membership level IDs included in the view_item event. Return an empty array to include every level that allows new signups.

apply_filters( 'pmproga4_track_level_ids', array $track_levels );

Parameters

  • $track_levels: array; Membership level IDs selected in the Levels to Track setting.

pmproga4_default_custom_dimension

Filters the default event parameters the Add On calculates for each page load. Remove a key to stop sending that parameter.

apply_filters( 'pmproga4_default_custom_dimension', array $custom_dimensions );

Parameters

  • $custom_dimensions: array; Default event parameters as key => value pairs. Default keys are post_type, author, and category.

pmproga4_custom_dimensions

Filters the final event parameters sent to Google Analytics. Use this to add your own parameters or change the default values.

apply_filters( 'pmproga4_custom_dimensions', array $gtag_config_custom_dimensions );

Parameters

  • $gtag_config_custom_dimensions: array; Event parameters for the current page as key => value pairs.

pmproga4_default_user_properties

Filters the default user properties the Add On calculates for the current user. Remove a key to stop sending that property.

apply_filters( 'pmproga4_default_user_properties', array $user_properties );

Parameters

  • $user_properties: array; Default user properties as key => value pairs. The default key is membership_level.

pmproga4_user_properties

Filters the final user properties sent to Google Analytics. Use this to add your own properties, such as a non-identifying User Field value.

apply_filters( 'pmproga4_user_properties', array $gtag_config_user_properties );

Parameters

  • $gtag_config_user_properties: array; User properties for the current user as key => value pairs.

Remember to create a matching custom dimension in GA4 for any event parameter or user property you add.

Last updated on November 6, 2026


Was this article helpful?
YesNo