A friend recently emailed me. He’d read a book that instructed him to include the Google Analytics tracking code into his “header.php” file. That’s the right way for some themes. But he was using a Genesis child theme, and no header.php file exists. He had a good question: how do you include Google Analytics tracking in a Genesis theme?
Thankfully, there are two simple ways to do it. Method 1 is just for WordPress sites which use a Genesis (StudioPress) theme; Method 2 will work for any WordPress website.
Method 1: Paste your Analytics tracking code into the Genesis settings page
Here are 4 fast steps, using the EmptyMirrorBooks.com website as an example. (I’ve obscured the site’s tracking ID for privacy’s sake.)
1. Log into your Google Analytics account.
(It’s at analytics.google.com.) Click on your website; on the next page click Admin.
2. Then, click Tracking Info & Tracking Code.
3. Scroll down to Website Tracking.
Copy the tracking script (code) from the box.
(Tip: To quickly do this, put your cursor in the box with the code, then press the CTRL and A keys on your keyboard together. All the text will be selected. Press CTRL and C to copy the script.)
This script includes your Google Analytics ID and the code that’s necessary to send tracking information back to Google Analytics. That information is used to generate the Analytics reports.
4. Return to your website.
Log in, then go to Genesis –> Theme Settings. Scroll down to the bottom of the page, and paste your Google Analytics tracking script into the “header scripts” box. (Tip: Put your cursor in the box, then press CTRL and V together to paste.)
Click “save changes.”
That’s all there is to it — you’re done!
You can now log into the Google Analytics website to review your reports, anytime.
Method 2: Use the Google Analytics Dashboard for WP plugin.
Want an easy way to see your reports right on your WordPress dashboard (rather than logging into the Analytics website)?
First, sign up for your Google Analytics account.
1. In WordPress, go to Plugins –> Add New.
Search for Google Analytics Dashboard for WP. (It’s the one by Alin Marcu.) Then click to install and activate it.
2. From the bottom of the Admin menu, go Google Analytics –> General Settings.
Click the “Authorize Plugin” button, then click the “Get Access Code” link. A new window will open.
When prompted to log into Google do so, and on the next page click “allow” to authorize the plugin.
Copy the code that’s generated.
3. Go back to the Google Analytics Dashboard plugin page.
Paste your access code into the field provided and click the “Save” button. That’s all there is to it.
After saving the code, you’ll be redirected to a page where you will see your Google Analytics tracking ID, etc. There’s really nothing else you need to do here, but you can change the color scheme of the report if you like.
5. There’s nothing more to do. Really.
You can safely ignore the other settings pages: backend settings, frontend settings, tracking code, errors & debug). (But of course, feel free to explore.)
Now, you can go to your dashboard to view the various reports. There aren’t as many reports here as you’d find on the GA website, but if you are looking for quick stats about the number of visitors you’ve had, what they looked at, and where they came from it’s enough.
Just to reiterate — if you install this plugin, you don’t need to paste the tracking code into the Genesis settings page as described in Method 1. (If you do both, your analytics numbers may be doubled.)
Have questions? I’d be glad to help – just email me.