Last active
March 17, 2021 09:03
-
-
Save chavesm/3a3b95f381f4fe7ec558b0ec8e39c966 to your computer and use it in GitHub Desktop.
MonsterInsights Add GA4 Measurement ID for Dual Tracking (UA and GA4)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function monsterinsights_custom_add_ga4_tracking() { | |
echo "__gtagTracker( 'config', 'G-12345678' );"; // Change the measurement ID to yours. | |
} | |
add_action( 'monsterinsights_frontend_tracking_gtag_after_pageview', 'monsterinsights_custom_add_ga4_tracking', 15 ); | |
/** Add to child theme's functions.php file. */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment