How do I add my Google Analytics tag sitewide to a WordPress site?
 by Kristi Hagen

How do I add my Google Analytics tag sitewide to a WordPress site?

  • I saw your Search Engine Byte about using a WordPress plugin called SOGO Header Footer to add Google Analytics code to a single page.

    I'm wondering does the same process hold true to add code sitewide? In other words, is there a way to add a tracking code to the settings of a plugin, and have that code automatically added to every page on the site? Would that same SOHO plugin be the best way to do that or is there a better one for sitewide distribution?

Answer:

Yes, you can use SOGO to add code sitewide, you'll find that setting in Dashboard > Settings > Header Footer Settings.

Another handy capability is that you can also add custom JavaScript such as Schema.org markup on any individual page/post.

Some WordPress themes even have a setting where you can add your Google Analytics tracking code — sometimes you just put in the UA code, other's you paste the entire JavaScript for it. You'll have to check to see if your theme enables you to do that. If it's built into your WP theme then it's easy to do.

Another option is to manually modify the theme header.php file. Ideally you should be familiar with working in PHP to make edits and using a child theme if you do this.SEN article end

...

TO READ THE FULL ARTICLE