Last active
February 8, 2020 16:02
-
-
Save deeman/02e313c4c21b1dc22244eece5d99a055 to your computer and use it in GitHub Desktop.
Setup Google Analytics tracking via PHP-hook
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
| //Add Google Analytics function | |
| function google_analytics() { | |
| include_once("analyticstracking.php"); | |
| } | |
| //Add tracking action, set Google Analytics | |
| add_action('wp_head', 'google_analytics'); |
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
| Step 1: Create a PHP-file in the rot, name it "anylyticstracking.php". | |
| Step 2: Copy the tracking script from your Google Analytics account and paste it into the "analyticstracking.php"-file. | |
| Step 3: Go to your Child Theme and edit your "functions.php"-file. Copy/Paste code abowe. | |
| Save. | |
| Done! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment