Created
March 7, 2022 12:05
-
-
Save wpflames/782acbcb2ea913dcd0eaf1f014437a79 to your computer and use it in GitHub Desktop.
Global tag
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 | |
| // ========================================================================= | |
| // ADD GOOGLE ANALYTICS GLOBAL TAG TO WP_HEAD | |
| // ========================================================================= | |
| function add_global_tag_for_ads() { | |
| echo ' | |
| <!-- Global site tag (gtag.js) - Google Ads: ************ --> | |
| <script async src="https://www.googletagmanager.com/gtag/js?id=AW************script> | |
| <script> | |
| window.dataLayer = window.dataLayer || []; | |
| function gtag(){dataLayer.push(arguments);} | |
| gtag("js", new Date()); | |
| gtag("config", "AW-************"); | |
| </script> | |
| '; | |
| } | |
| add_action('wp_head', 'add_global_tag_for_ads'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment