Adding Google analytics

After reading this article I am a bit confused on what I need to do to install Google Analytics. I have already installed the plugin that comes with X-Theme and I am using a child theme. According to the linked article above the support persons says…

Adding code to function.php is necessary if you are taking the child theme route. However, you can also use Google Analytics plugin.

The second line, “You can ALSO…” is where I am confused. So if I am using a child theme do I need to put in this code into the child themes config.php file in addition to the plugin or does the plugin not need to be used if I am using a child theme?

and is this the EXACT code that needs to go in it?

add_action('wp_head','custom_script');
function custom_script() {
?>

<?php
}

Many thanks,
Houston

Hi Houston,

You just need to choose your preferred method.

I suggest you go with Google Analytics plugin.

When using that plugin, no need to add a code in your child theme.

Thanks

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.