duracelltomi / gtm4wp

Google Tag Manager plugin for WordPress
https://gtm4wp.com/
GNU General Public License v3.0
147 stars 96 forks source link

Feature: Add order argument #341

Closed abdulhadicse closed 6 months ago

abdulhadicse commented 6 months ago

The proposed modification aims to enhance the GTM4WP_WPFILTER_ECC_PURCHASE_DATALAYER and GTM4WP_WPFILTER_EEC_ORDER_DATA filters by including the WooCommerce order data.

Currently, while utilizing the GTM4WP_WPFILTER_EEC_ORDER_DATA filter, developers encounter limitations when attempting to enrich the data layer with additional information. Specifically, the absence of the order ID within this filter poses a challenge, requiring developers to resort to backtracking procedures to retrieve the order ID using order numbers.

This would be achieved by adding the $order argument to the filter, which would enable developers to access complete order data when modifying data layer values. The addition of the order object alongside the existing data layer would allow users to customize tracking and analytics implementations based on specific order attributes and requirements, thereby improving tracking efficiency.