Adding google analytics to functions.php
-
Hello, if someone could take time and answer this question I would be thankful! ??
Goal:
Add google analytics to my childtheme.Question:
1.What code do I add in my functions.php? I found the code snippet down below:add_action('wp_head','my_analytics', 20); function my_analytics() { ?> YOUR GOOGLE ANALYTICS TRACKING CODE HERE (looks like <script type="text/javascript">.....</script> ) <?php }
Would this code above be enough?
2. If you think it is better to add google analytics in the child themes header.php I wonder: How is the parent-theme-header.php file related to the the child-theme-header.php? Does the child-theme-header.php need to have the exact same code as the parent-theme-header.php (except from the code added), or could it just contain the additional code snippets?.
The page I need help with: [log in to see the link]
Viewing 9 replies - 1 through 9 (of 9 total)
Viewing 9 replies - 1 through 9 (of 9 total)
- The topic ‘Adding google analytics to functions.php’ is closed to new replies.