stape-io / gtm-server-side-wordpress-plugin

Google Tag Manager Server-Side plugin for WordPress
https://stape.io/how-to-add-google-tag-manager-server-side-container-to-wordpress/
GNU General Public License v2.0
16 stars 4 forks source link

Add filters for webhook payloads #17

Closed mch0lic closed 1 week ago

mch0lic commented 1 week ago

It's always a good idea to include custom actions and filters in plugins that allows to modify the functionality of the plugin without the need of patching.

Larger sites often have additional data that is collected and stored for each order, so it makes sense to allow to post that data to sGTM instance.

Given the plugin is using wp_remote_post() it is possible to intercept the request and make change, but its not very efficient, because we need to parse / check what URL is called. The more elegant solution is apply_filters().