PHP and Google Analytics Help

I am trying to do an SEO audit for a client. He uses a cpanel hosted wordpress site. I have tried to put in the google analytics tracker code into the functions.php site, but the code is not working. I have compiled the pasted code below to check for errors, and it is all good.


add_action( 'wp_head' , 'wpb_add_googleanalytics' );

function wpb_add_googleanalytics() { ?>

// Paste your Google Analytics code from Step 4 here

<?php } ?>

This is what I need pasted, then I paste in the analytics tracker code as indicated.

Below is the last section of code where I am trying to paste:

if ( !function_exists(‘prowess_select_get_module_part’) ) {
function prowess_select_get_module_part($module) {
return $module;

I need to paste in the above mentioned tracker code below all of the other lines of site code, or so I think. Please advise what steps I can take in order to get the tracker code in place. Any help would be greatly appreciated!


And you wouldn’t use something like Yoast, why exactly? And what are you auditing if there isn’t currently SEO on the site?

I guess it’s not really an audit but more of just trying to get the analytics installed for SEO and general site data.

Then, the Yoast plugin is what you want to install.

Sponsor our Newsletter | Privacy Policy | Terms of Service