You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be very handy to have a filter for the parameters that are passed to the gtag config call.
Currently the gtag config call is build by the settings of the ui and plainly appended to a string.
GoogleAnalytics configurations can differ a lot, specially in times if gpdr, google signals and so on.
Currently i would like to append the cookie_flags option with a value of samesite=none;secure to my analytics config and have no possibilities to do that easily.
Describe the solution you'd like
A simple filter call with an array of the parameters that are passed to gtag config in the function public static function load_analytics( $order = false ) of the class-wc-google-gtag-js.php file.
It would be really nice if we could build the config call from a key-value array and filter it before converting it to the config json string.
I believe this is a simple and backward compatible solution that can be useful in many situations, like adding params, editing params and so on....
I know there is a filter woocommerce_gtag_snippet where i could preg_replace parameters into the script output but this feels very hacky and is prone to errors.
The text was updated successfully, but these errors were encountered:
Additional calls can be included by adding an inline script using the woocommerce-google-analytics-integration handle so I'm marking this issue as closed.
Is your feature request related to a problem?
It would be very handy to have a filter for the parameters that are passed to the gtag config call.
Currently the gtag config call is build by the settings of the ui and plainly appended to a string.
GoogleAnalytics configurations can differ a lot, specially in times if gpdr, google signals and so on.
Currently i would like to append the cookie_flags option with a value of samesite=none;secure to my analytics config and have no possibilities to do that easily.
Describe the solution you'd like
A simple filter call with an array of the parameters that are passed to gtag config in the function public static function load_analytics( $order = false ) of the class-wc-google-gtag-js.php file.
Current Code:
gtag('config', '" . esc_js( $gtag_id ) . "', { 'allow_google_signals': " . ( 'yes' === self::get( 'ga_support_display_advertising' ) ? 'true' : 'false' ) . ", 'link_attribution': " . ( 'yes' === self::get( 'ga_support_enhanced_link_attribution' ) ? 'true' : 'false' ) . ", 'anonymize_ip': " . ( 'yes' === self::get( 'ga_anonymize_enabled' ) ? 'true' : 'false' ) . ", 'linker':{ 'domains': " . wp_json_encode( $gtag_cross_domains ) . ", 'allow_incoming': " . ( 'yes' === self::get( 'ga_linker_allow_incoming_enabled' ) ? 'true' : 'false' ) . ", }, 'custom_map': { 'dimension1': 'logged_in' }, 'logged_in': '$logged_in' } );
It would be really nice if we could build the config call from a key-value array and filter it before converting it to the config json string.
I believe this is a simple and backward compatible solution that can be useful in many situations, like adding params, editing params and so on....
Something like:
woocommerce_gtag_config_params($arrayofparams)
Describe alternatives you've considered
I know there is a filter woocommerce_gtag_snippet where i could preg_replace parameters into the script output but this feels very hacky and is prone to errors.
The text was updated successfully, but these errors were encountered: