GTM4WP icon
Analytics & Tracking

GTM4WP hooks reference

  • By Thomas Geiger
  • v2.1.1 New
  • Updated

GTM4WP 2.1.1 has 1 actions and 41 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 GTM4WP fires an action
add_action( 'gtm4wp_register_modules', function( $registry ) {
	// Your code runs here.
}, 10, 1 );

// Change a value GTM4WP is about to use
add_filter( 'woocommerce_cart_item_product', function( $cart_item_data, $cart_item_data2, $cart_item_id ) {
	// Change $cart_item_data here.
	return $cart_item_data;
}, 10, 3 );

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/Modules/WooCommerce/PageDataLayer.php line 262 · used in 5 places
    /**
     * Applying WooCommerce's own woocommerce_cart_item_product filter here is
     * essential in order to hide everything from tracking codes that is not
     * visible to the user as well.
     */
    apply_filters( 'woocommerce_cart_item_product', $cart_item_data['data'], $cart_item_data, $cart_item_id );
  • src/Admin/Docs.php line 71
    /**
     * Filters the documentation URL of a module or an option, so a third party
     * module can resolve against its own site. Returning '' removes the help link.
     * Validated afterwards: only http(s) survives.
     */
    apply_filters( 'gtm4wp_admin_doc_url', $url, $path, $anchor );
  • src/Modules/EasyDigitalDownloads/DownloadData.php line 922
    /**
     * Filters the order statuses whose orders are eligible for the purchase event.
     */
    apply_filters( 'gtm4wp_edd_purchase_trackable_statuses', $statuses, $order );
  • src/Modules/MediaEvents/MediaEventsModule.php line 209
    /**
     * Filters whether GTM4WP may request a third-party media player SDK.
     */
    apply_filters( 'gtm4wp_media_sdk_blocked', false );
  • src/Modules/PageVariables/PageVariablesModule.php line 448
    /**
     * Filters the language code reported for the current page.
     */
    apply_filters( 'gtm4wp_page_language', $page_language );
  • src/Modules/PageVariables/PageVariablesModule.php line 563
    /**
     * Filters the list of post author IDs output into the data layer on a post
     * with multiple authors (PublishPress Authors).
     */
    apply_filters( 'gtm4wp_page_post_author_ids', $author_ids, $multiple_authors );
  • src/Modules/PageVariables/PageVariablesModule.php line 582
    /**
     * Filters the list of post author display names output into the data layer on
     * a post with multiple authors (PublishPress Authors).
     */
    apply_filters( 'gtm4wp_page_post_authors', $author_names, $multiple_authors );
  • src/Modules/PageVariables/PageVariablesModule.php line 736
    /**
     * Filters whether a post meta key is included in the data layer.
     */
    apply_filters( 'gtm4wp_post_meta_in_datalayer', true, $post_meta_key );
  • src/Modules/PageVariables/PageVariablesModule.php line 893
    /**
     * Filters the term id used as the primary category of the current post (e.g.
     * for another SEO plugin or a custom taxonomy).
     */
    apply_filters( 'gtm4wp_primary_category_term_id', $primary_category_id, get_the_ID() );
  • src/Modules/WooCommerce/ProductData.php line 770
    /**
     * Filters the order statuses whose orders are eligible for the purchase event.
     */
    apply_filters( 'gtm4wp_purchase_trackable_statuses', $statuses, $order );
  • src/Modules/PageVariables/PageVariablesModule.php line 793
    /**
     * Filters the words-per-minute reading speed used to estimate the reading time
     * of the current post.
     */
    apply_filters( 'gtm4wp_reading_time_wpm', 200 );
  • src/Module/Registry.php line 81
    /**
     * Fires after the built-in modules have been registered.
     */
    do_action( 'gtm4wp_register_modules', $registry );
  • src/Admin/SiteHealthInfo.php line 141
    /**
     * Filters the rows of the plugin's Site Health Info section.
     */
    apply_filters( 'gtm4wp_site_health_info', $fields, $this->options );
  • src/Modules/WooCommerce/PageDataLayer.php line 835
    /**
     * The site's own grace period. All three arguments are passed because
     * WooCommerce passes three (RI-25): WP_Hook never pads the list, so a callback
     * written to the documented signature would raise an ArgumentCountError.
     * Residual 3: 7.9.x has no grace period, so for ten minutes the mirror
     * publishes where 7.9.x demands verification - bounded by the order max-age
     * gate, and the behaviour 8.0.0 adopted.
     */
    apply_filters( 'woocommerce_order_email_verification_grace_period', 10 * MINUTE_IN_SECONDS, $order, 'order-received' );
  • src/Modules/WooCommerce/PageDataLayer.php line 859
    /**
     * Upstream's final say, honoured so a store that disabled verification keeps a
     * complete data layer; three arguments per RI-25. The value passed in is true
     * where upstream may have computed false (unmodelled request-identity terms),
     * so a passthrough changes nothing and only an explicit false publishes.
     * Residual 4: a strictly value-inverting callback would publish in exactly
     * those states. Applied af...
     */
    apply_filters( 'woocommerce_order_email_verification_required', true, $order, 'order-received' );
  • src/Modules/WooCommerce/PageDataLayer.php line 792
    /**
     * Whether known (non-guest) shoppers must be logged in to see the order. The
     * gate is unconditional from 7.9.0 and filterable from 8.4.0; a false from a
     * site callback is honoured on 7.9.0-8.3.x too (residual 2: the admin asked
     * for the gate to be off, the mirror follows the admin).
     */
    apply_filters( 'woocommerce_order_received_verify_known_shoppers', true );
  • src/Modules/WooCommerce/PageDataLayer.php line 274
    /**
     * This filter allows 3rd party code to exclude specific products from
     * reporting.
     */
    apply_filters( 'woocommerce_widget_cart_item_visible', true, $cart_item_data, $cart_item_id );
  • src/Modules/UserEvents/UserEventsModule.php line 86
    apply_filters( "gtm4wp_{GTM4WP_OPTION_EVENTS_FORMMOVE}", true );
  • src/Modules/EasyDigitalDownloads/EasyDigitalDownloadsModule.php line 193
    apply_filters( "gtm4wp_{GTM4WP_OPTION_INTEGRATE_EDDTRACKECOMMERCE}", true );
  • src/Modules/WooCommerce/WooCommerceModule.php line 320
    apply_filters( "gtm4wp_{GTM4WP_OPTION_INTEGRATE_WCTRACKECOMMERCE}", true );
  • src/Modules/ContactForm7/ContactForm7Module.php line 80
    apply_filters( "gtm4wp_{GTM4WP_OPTION_INTEGRATE_WPCF7}", true );
  • src/Modules/MediaEvents/MediaEventsModule.php line 280
    apply_filters( 'gtm4wp_cloudflarestream', true );
  • src/Modules/MediaEvents/MediaEventsModule.php line 248
    apply_filters( 'gtm4wp_dailymotion', true );
  • src/Modules/MediaEvents/MediaEventsModule.php line 240
    apply_filters( 'gtm4wp_html5media', true );
  • src/Modules/MediaEvents/MediaEventsModule.php line 294
    apply_filters( 'gtm4wp_jwplayer', true );
  • src/Modules/MediaEvents/MediaEventsModule.php line 274
    apply_filters( 'gtm4wp_mixcloud', true );
  • src/Modules/MediaEvents/MediaEventsModule.php line 234
    apply_filters( 'gtm4wp_soundcloud', true );
  • src/Modules/MediaEvents/MediaEventsModule.php line 310
    apply_filters( 'gtm4wp_spotify', true );
  • gtm4wp_twitch

    filter
    src/Modules/MediaEvents/MediaEventsModule.php line 316
    apply_filters( 'gtm4wp_twitch', true );
  • src/Modules/MediaEvents/MediaEventsModule.php line 302
    apply_filters( 'gtm4wp_videopress', true );
  • gtm4wp_vimeo

    filter
    src/Modules/MediaEvents/MediaEventsModule.php line 228
    apply_filters( 'gtm4wp_vimeo', true );
  • gtm4wp_wistia

    filter
    src/Modules/MediaEvents/MediaEventsModule.php line 286
    apply_filters( 'gtm4wp_wistia', true );
  • src/Modules/PageVariables/PageVariablesModule.php line 399
    apply_filters( 'single_post_title', $_master_post->post_title, $_master_post );
  • src/Modules/WooCommerce/PageDataLayer.php line 445
    apply_filters( 'woocommerce_cart_item_visible', true, $cart_item_data, $cart_item_id );
  • src/Modules/WooCommerce/PageDataLayer.php line 565
    apply_filters( 'woocommerce_checkout_cart_item_visible', true, $cart_item_data, $cart_item_id );
  • src/Modules/WooCommerce/ProductData.php line 966
    apply_filters( 'woocommerce_order_item_visible', true, $order_item );
  • src/Modules/WooCommerce/PageDataLayer.php line 676
    apply_filters( 'woocommerce_thankyou_order_id', $order_id );
  • src/Modules/WooCommerce/PageDataLayer.php line 683
    apply_filters( 'woocommerce_thankyou_order_key', $order_key );
  • src/Modules/PageVariables/PageVariablesModule.php line 426
    apply_filters( 'wpml_current_language', null );
  • src/Frontend/DefaultLanguage.php line 97
    apply_filters( 'wpml_default_language', null );
  • src/Frontend/DefaultLanguage.php line 99
    apply_filters( 'wpml_object_id', $id, $type, true, $default_lang );

Generated from GTM4WP'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: