Hello @wendihihihi,
You can use wpmm_head
hook to add gtag.js script.
Example:
// this snippet should be placed inside functions.php of your theme or child-theme
add_action('wpmm_head', 'wpmm_head_gtag_script');
function wpmm_head_gtag_script() {
echo "<script async src=\"https://www.googletagmanager.com/gtag/js?id=UA-XXXXXXX\"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag('js', new Date());
gtag('config', 'UA-XXXXXXX');
</script>";
}
You have to replace UA-XXXXXXX
with your real Google Analytics ID.
—
George
-
This reply was modified 6 years, 7 months ago by George J.
-
This reply was modified 6 years, 7 months ago by George J.
-
This reply was modified 6 years, 7 months ago by George J.