GTM Kit 2.24.0 has 6 actions and 55 filters, read directly from its source code on Nov 17, 2026. The list updates automatically when a new version is released.
How to use these hooks
Actions let you run your own code at a specific moment. Filters let you change a value before the plugin uses it. Put your code in a child theme's functions.php or a code-snippets plugin, never in the plugin's own files, because updates overwrite them.
// Run your own code when GTM Kit fires an action
add_action( 'gtmkit_settings_changed_by_ability', function( $current_user_id, $written ) {
// Your code runs here.
}, 10, 2 );
// Change a value GTM Kit is about to use
add_filter( 'gtmkit_consent_default_settings_enabled', function( $value ) {
// Change $value here.
return $value;
}, 10, 1 );Parts of a name in {braces} are filled in at runtime (for example a post type or field ID). Choose Example on any hook for a ready-to-edit snippet.
All hooks
-
/** * Whether GTM Kit should emit the consent default block at all. */ apply_filters( 'gtmkit_consent_default_settings_enabled', (bool) $this->options->get( 'general', 'gcm_default_settings' ) ); -
/** * Method label for the `sign_up` event from the WordPress core hook. The * Woo-specific hook upgrades this to `woocommerce` after the fact. */ apply_filters( 'gtmkit_engagement_event_signup_method', 'wordpress', $user_id ); -
gtmkit_abilities_enabled
filter/** * Filters whether GTM Kit registers its abilities with the WordPress Abilities * API. */ apply_filters( 'gtmkit_abilities_enabled', true ); -
/** * Filters the settings AI assistants may change through the Abilities API. */ apply_filters( 'gtmkit_abilities_writable_settings', self::WRITABLE ); -
gtmkit_active_cmp
filter/** * Filters the consent platform GTM Kit treats as active. */ apply_filters( 'gtmkit_active_cmp', $detected ); -
gtmkit_blocks_supported
filter/** * Filter the canonical list of block names that trigger the GTM Kit block * tracking bundle. */ apply_filters( 'gtmkit_blocks_supported', self::SUPPORTED_BLOCKS ); -
gtmkit_cmp_display_name
filter/** * Filters the name a consent platform is shown under. */ apply_filters( 'gtmkit_cmp_display_name', $name, $slug ); -
gtmkit_consent_default_state
filter/** * Per-category Consent Mode v2 default state. */ apply_filters( 'gtmkit_consent_default_state', [ 'ad_personalization' => $options->get( 'general', 'gcm_ad_personalization' ) ? 'granted' : 'denied', 'ad_storage' => $options->get( 'general', 'gcm_ad_storage' ) ? 'granted' : 'denied', 'ad_user_data' => $options->get( 'general', 'gcm_ad_user_data' ) ? 'granted' : 'denied', 'analytics_storage' => $options->get( 'general', 'gcm_analytics_storage' ) ? 'granted' : 'denied', 'personalization_stor... ); -
gtmkit_consent_region
filter/** * Region codes the consent defaults apply to. */ apply_filters( 'gtmkit_consent_region', $this->options->get( 'general', 'gcm_region' ) ); -
/** * Registry of consent signal sources. Highest-priority active source wins. */ apply_filters( 'gtmkit_consent_signal_sources', [] ); -
gtmkit_consent_unknown
filter/** * How the purchase's contact details are treated when consent is unknown. */ apply_filters( 'gtmkit_consent_unknown', 'allow' ); -
gtmkit_copy_site_host_labels
filter/** * Host labels that suggest a site is a copy rather than the real one. */ apply_filters( 'gtmkit_copy_site_host_labels', self::COPY_HOST_LABELS ); -
/** * The data layer item built from a cart line. */ apply_filters( 'gtmkit_datalayer_cart_item_data', $item, $cart_item, $cart_item_key, $event_context ); -
/** * The data layer item built from an order line. */ apply_filters( 'gtmkit_datalayer_order_item_data', $order_item, $item, $order ); -
/** * Cookie name used to hand off engagement events from the server to the * frontend module. Override when a different cookie name is required for * reverse-proxy or namespacing reasons. */ apply_filters( 'gtmkit_engagement_event_cookie_name', self::COOKIE_NAME ); -
/** * Extra fields merged into the `generate_lead` payload. Sites that want to * assign a lead value (e.g. `value` + `currency`) return them here. Empty by * default; the event is otherwise carried with the same form metadata the CF7 * integration already exposes (`formId`, `response`). */ apply_filters( 'gtmkit_engagement_event_generate_lead_payload', [], [] ); -
/** * Method label for the `login` event. Defaults to `wordpress` for every login * path (WP core, Woo My Account, REST). Sites with social-login plugins can * override per provider. */ apply_filters( 'gtmkit_engagement_event_login_method', 'wordpress', $user ); -
/** * The search term carried by the `search` engagement event. Runs before the * term reaches the frontend so the same value the JS pushes is the value the * filter sees. */ apply_filters( 'gtmkit_engagement_event_search_term', $term ); -
/** * Final veto applied just before the cookie is written. Lets a site drop any * engagement event for any reason without touching the admin toggles. */ apply_filters( 'gtmkit_engagement_event_should_emit', true, $event_name, $payload ); -
gtmkit_event_should_defer
filter/** * Per-event deferral decision. Default: do not defer. */ apply_filters( 'gtmkit_event_should_defer', false, $event_name, $event_payload, $consent_state ); -
gtmkit_excluded_url_patterns
filter/** * Filter the effective list of URL-exclusion patterns just before matching. * Useful for code that wants to add, remove, or replace patterns without * persisting them to the admin option. */ apply_filters( 'gtmkit_excluded_url_patterns', $patterns, $path ); -
gtmkit_introductions
filter/** * Filters the list of registrable introductions. */ apply_filters( 'gtmkit_introductions', $bucket->sorted() ); -
/** * Whether the current request should be treated as a search results page for * the purpose of emitting the `search` engagement event. Useful for headless * or block-based templates that bypass `is_search()`. */ apply_filters( 'gtmkit_is_search_results_page', $base, $wp_query instanceof WP_Query ? $wp_query : null ); -
gtmkit_is_url_excluded
filter/** * Filter the final URL-exclusion decision for the current request. Last word * for code that needs to force GTM Kit on or off based on signals beyond the * stored pattern list. */ apply_filters( 'gtmkit_is_url_excluded', $is_excluded, $normalized_path ); -
gtmkit_option_value
filter/** * Filters a resolved option value as it leaves the read path. */ apply_filters( 'gtmkit_option_value', $value, $group, $key ); -
gtmkit_resolve_item_discount
filter/** * Filter the resolved per-unit coupon discount. */ apply_filters( 'gtmkit_resolve_item_discount', $this->round( $per_unit ), $item, $exclude_tax ); -
gtmkit_resolve_tax_mode
filter/** * Filter the resolved tax mode for the data layer. */ apply_filters( 'gtmkit_resolve_tax_mode', $exclude_tax ); -
gtmkit_settings
filter/** * Filters the settings payload localised to the admin settings app. */ apply_filters( 'gtmkit_settings', $settings ); -
/** * Fires after an AI assistant changed settings through the Abilities API. */ do_action( 'gtmkit_settings_changed_by_ability', get_current_user_id(), $written ); -
gtmkit_site_health_tests
filter/** * Filters the Site Health tests GTM Kit registers. */ apply_filters( 'gtmkit_site_health_tests', $gtmkit_tests, $this ); -
gtmkit_snippet_scan_url
filter/** * Filters the sample page the tracking scan requests. */ apply_filters( 'gtmkit_snippet_scan_url', home_url( '/' ) ); -
/** * Consent categories that must be `granted` before the strong-block shim will * unmask the GTM container. Default: analytics_storage and ad_storage, the two * categories most GTM containers depend on. */ apply_filters( 'gtmkit_strong_block_required_categories', [ 'analytics_storage', 'ad_storage' ] ); -
gtmkit_support_sync_config
filter/** * Filters the support sync timing configuration. */ apply_filters( 'gtmkit_support_sync_config', $defaults ); -
/** * Filters whether AI assistants may change GTM Kit settings through the * WordPress Abilities API. */ apply_filters( 'gtmkit_write_abilities_enabled', false ); -
gtmkit_admin_capability
filterapply_filters( 'gtmkit_admin_capability', is_multisite() ? 'manage_network_options' : 'manage_options' ); -
gtmkit_container_active
filterapply_filters( 'gtmkit_container_active', true ); -
apply_filters( 'gtmkit_datalayer_content_order_received', $data_layer ); -
gtmkit_datalayer_item_data
filterapply_filters( 'gtmkit_datalayer_item_data', $item_data, $download, $event_context ); -
gtmkit_process_options
filterapply_filters( 'gtmkit_process_options', $options ); -
gtmkit_activate
actiondo_action( 'gtmkit_activate' ); -
gtmkit_admin_init
actiondo_action( 'gtmkit_admin_init', $options, $util ); -
gtmkit_consent_admin_badges
filterapply_filters( 'gtmkit_consent_admin_badges', [] ); -
gtmkit_datalayer_content
filterapply_filters( 'gtmkit_datalayer_content', [] ); -
apply_filters( 'gtmkit_datalayer_exit_order_received', false, $order ); -
gtmkit_datalayer_script
filterapply_filters( 'gtmkit_datalayer_script', $script ); -
gtmkit_deactivate
actiondo_action( 'gtmkit_deactivate' ); -
apply_filters( 'gtmkit_disable_frontend_purchase_event', false ); -
apply_filters( 'gtmkit_header_script_attributes', $built ); -
gtmkit_header_script_data
filterapply_filters( 'gtmkit_header_script_data', [] ); -
apply_filters( 'gtmkit_header_script_settings', [ 'datalayer_name' => $this->datalayer_name, 'console_log' => $this->options->get( 'general', 'console_log' ), ] ); -
gtmkit_integrations_data
filterapply_filters( 'gtmkit_integrations_data', $integrations_data ); -
gtmkit_integrations_plugins
filterapply_filters( 'gtmkit_integrations_plugins', $plugins ); -
gtmkit_options_defaults
filterapply_filters( 'gtmkit_options_defaults', $schema ); -
gtmkit_options_set
actiondo_action( 'gtmkit_options_set' ); -
do_action( 'gtmkit_options_validation_failed', $errors ); -
gtmkit_settings_registry
filterapply_filters( 'gtmkit_settings_registry', [ 'fields' => [], 'sections' => [], ], self::SETTINGS_REGISTRY_SCHEMA_VERSION ); -
https_local_ssl_verify
filterapply_filters( 'https_local_ssl_verify', false, $url ); -
apply_filters( 'woocommerce_cart_item_product', $cart_item['data'], $cart_item, $cart_item_key ); -
apply_filters( 'woocommerce_order_received_verify_known_shoppers', true ); -
apply_filters( 'woocommerce_thankyou_order_id', absint( $wp->query_vars['order-received'] ?? 0 ) ); -
apply_filters( 'woocommerce_thankyou_order_key', empty( $_GET['key'] ) ? '' : wc_clean( wp_unslash( $_GET['key'] ) ) );
Generated from GTM Kit's GPL-licensed source code. Hooks inside bundled third-party libraries are not listed.
Can't find the right hook?
We can build the customisation for you. Describe what you need: