Skip to content

Instantly share code, notes, and snippets.

@maheshwaghmare
Created January 20, 2023 12:34
Show Gist options
  • Save maheshwaghmare/ed1bf11b453887543b203dc9b279aae9 to your computer and use it in GitHub Desktop.
Save maheshwaghmare/ed1bf11b453887543b203dc9b279aae9 to your computer and use it in GitHub Desktop.
Add/Modify Google tag manager variables for Rank Math SEO
<?php
if ( ! function_exists( 'prefix_analytics_gtag_config' ) ) :
/**
* Add/Modify Google tag manager variables
*
* @param array $args Google analytics arguments
*/
function prefix_analytics_gtag_config( $args = [] ) {
$args[] = 'cookie_flags:"max-age=7200;secure;samesite=none"';
return $args;
}
add_filter( 'rank_math/analytics/gtag_config', 'prefix_analytics_gtag_config' );
endif;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment