GTM Kit icon
Analytics & Tracking

GTM Kit hooks reference

  • By TLA Media
  • v2.24.0 New
  • Updated

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.

functions.phpyour child theme
// 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

  • src/Frontend/EngagementEvents.php line 164 · used in 2 places
    /**
     * 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 );
  • src/Abilities/Abilities.php line 161
    /**
     * Filters whether GTM Kit registers its abilities with the WordPress Abilities
     * API.
     */
    apply_filters( 'gtmkit_abilities_enabled', true );
  • src/Abilities/SettingsChange.php line 167
    /**
     * Filters the settings AI assistants may change through the Abilities API.
     */
    apply_filters( 'gtmkit_abilities_writable_settings', self::WRITABLE );
  • src/Common/CMPDetection.php line 120
    /**
     * Filters the consent platform GTM Kit treats as active.
     */
    apply_filters( 'gtmkit_active_cmp', $detected );
  • src/Integration/WooCommerceBlocks.php line 158
    /**
     * Filter the canonical list of block names that trigger the GTM Kit block
     * tracking bundle.
     */
    apply_filters( 'gtmkit_blocks_supported', self::SUPPORTED_BLOCKS );
  • src/Common/CMPDetection.php line 79
    /**
     * Filters the name a consent platform is shown under.
     */
    apply_filters( 'gtmkit_cmp_display_name', $name, $slug );
  • src/Common/SiteEnvironment.php line 133
    /**
     * 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 );
  • src/Integration/WooCommerce.php line 777
    /**
     * The data layer item built from a cart line.
     */
    apply_filters( 'gtmkit_datalayer_cart_item_data', $item, $cart_item, $cart_item_key, $event_context );
  • src/Integration/WooCommerce.php line 1333
    /**
     * The data layer item built from an order line.
     */
    apply_filters( 'gtmkit_datalayer_order_item_data', $order_item, $item, $order );
  • src/Integration/ContactForm7.php line 110
    /**
     * 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', [], [] );
  • src/Frontend/EngagementEvents.php line 128
    /**
     * 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 );
  • src/Frontend/EngagementEvents.php line 378
    /**
     * 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 );
  • src/Frontend/EngagementEvents.php line 400
    /**
     * 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 );
  • src/Frontend/EventDeferralGate.php line 59
    /**
     * Per-event deferral decision. Default: do not defer.
     */
    apply_filters( 'gtmkit_event_should_defer', false, $event_name, $event_payload, $consent_state );
  • src/Frontend/UrlExclusion.php line 42
    /**
     * 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 );
  • src/Admin/Introductions/Application/Introductions_Collector.php line 118
    /**
     * Filters the list of registrable introductions.
     */
    apply_filters( 'gtmkit_introductions', $bucket->sorted() );
  • src/Frontend/EngagementEvents.php line 349
    /**
     * 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 );
  • src/Frontend/UrlExclusion.php line 59
    /**
     * 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 );
  • src/Options/Options.php line 147
    /**
     * Filters a resolved option value as it leaves the read path.
     */
    apply_filters( 'gtmkit_option_value', $value, $group, $key );
  • src/Integration/Tax/TaxResolver.php line 194
    /**
     * Filter the resolved per-unit coupon discount.
     */
    apply_filters( 'gtmkit_resolve_item_discount', $this->round( $per_unit ), $item, $exclude_tax );
  • src/Integration/Tax/TaxResolver.php line 68
    /**
     * Filter the resolved tax mode for the data layer.
     */
    apply_filters( 'gtmkit_resolve_tax_mode', $exclude_tax );
  • src/Admin/GeneralOptionsPage.php line 192
    /**
     * Filters the settings payload localised to the admin settings app.
     */
    apply_filters( 'gtmkit_settings', $settings );
  • src/Abilities/SettingsChange.php line 435
    /**
     * Fires after an AI assistant changed settings through the Abilities API.
     */
    do_action( 'gtmkit_settings_changed_by_ability', get_current_user_id(), $written );
  • src/Admin/SiteHealth.php line 193
    /**
     * Filters the Site Health tests GTM Kit registers.
     */
    apply_filters( 'gtmkit_site_health_tests', $gtmkit_tests, $this );
  • src/Common/SnippetScan.php line 372
    /**
     * Filters the sample page the tracking scan requests.
     */
    apply_filters( 'gtmkit_snippet_scan_url', home_url( '/' ) );
  • src/Frontend/Frontend.php line 586
    /**
     * 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' ] );
  • src/Common/SupportSync.php line 175
    /**
     * Filters the support sync timing configuration.
     */
    apply_filters( 'gtmkit_support_sync_config', $defaults );
  • src/Abilities/SettingsChange.php line 148
    /**
     * Filters whether AI assistants may change GTM Kit settings through the
     * WordPress Abilities API.
     */
    apply_filters( 'gtmkit_write_abilities_enabled', false );
  • src/Abilities/Abilities.php line 312 · used in 7 places
    apply_filters( 'gtmkit_admin_capability', is_multisite() ? 'manage_network_options' : 'manage_options' );
  • src/Admin/SiteHealth.php line 578 · used in 6 places
    apply_filters( 'gtmkit_container_active', true );
  • src/Integration/EasyDigitalDownloads.php line 330 · used in 2 places
    apply_filters( 'gtmkit_datalayer_content_order_received', $data_layer );
  • src/Integration/EasyDigitalDownloads.php line 436 · used in 2 places
    apply_filters( 'gtmkit_datalayer_item_data', $item_data, $download, $event_context );
  • src/Options/Options.php line 231 · used in 2 places
    apply_filters( 'gtmkit_process_options', $options );
  • inc/main.php line 71
    do_action( 'gtmkit_activate' );
  • inc/main.php line 326
    do_action( 'gtmkit_admin_init', $options, $util );
  • src/Frontend/Frontend.php line 436
    apply_filters( 'gtmkit_datalayer_content', [] );
  • src/Integration/WooCommerce.php line 542
    apply_filters( 'gtmkit_datalayer_exit_order_received', false, $order );
  • src/Frontend/Frontend.php line 462
    apply_filters( 'gtmkit_datalayer_script', $script );
  • inc/main.php line 95
    do_action( 'gtmkit_deactivate' );
  • src/Integration/WooCommerce.php line 515
    apply_filters( 'gtmkit_disable_frontend_purchase_event', false );
  • src/Frontend/Frontend.php line 836
    apply_filters( 'gtmkit_header_script_attributes', $built );
  • src/Frontend/Frontend.php line 323
    apply_filters( 'gtmkit_header_script_data', [] );
  • src/Frontend/Frontend.php line 211
    apply_filters( 'gtmkit_header_script_settings', [ 'datalayer_name' => $this->datalayer_name, 'console_log' => $this->options->get( 'general', 'console_log' ), ] );
  • src/Admin/Integrations.php line 50
    apply_filters( 'gtmkit_integrations_data', $integrations_data );
  • src/Admin/Integrations.php line 68
    apply_filters( 'gtmkit_integrations_plugins', $plugins );
  • src/Options/Options.php line 105
    apply_filters( 'gtmkit_options_defaults', $schema );
  • src/Options/Options.php line 251
    do_action( 'gtmkit_options_set' );
  • src/Options/Options.php line 223
    do_action( 'gtmkit_options_validation_failed', $errors );
  • src/Admin/GeneralOptionsPage.php line 219
    apply_filters( 'gtmkit_settings_registry', [ 'fields' => [], 'sections' => [], ], self::SETTINGS_REGISTRY_SCHEMA_VERSION );
  • src/Admin/SiteHealth.php line 376
    apply_filters( 'https_local_ssl_verify', false, $url );
  • src/Integration/WooCommerce.php line 761
    apply_filters( 'woocommerce_cart_item_product', $cart_item['data'], $cart_item, $cart_item_key );
  • src/Integration/WooCommerce.php line 593
    apply_filters( 'woocommerce_order_received_verify_known_shoppers', true );
  • src/Integration/WooCommerce.php line 513
    apply_filters( 'woocommerce_thankyou_order_id', absint( $wp->query_vars['order-received'] ?? 0 ) );
  • src/Integration/WooCommerce.php line 525
    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: