Connecting Google Analytics to your Premium WordPress Account
If you have WordPress Premium you may have to connect your Google Analytics to your blog, without using a plugin. But before you get started, it’s important you backup your wordpress theme. You’ll be editing the code that outputs your site directly, so backing up your theme means that you can easily revert back to it in case something goes wrong.
Backing up your WordPress theme
You can choose to backup your theme:
- manually or
- by installing a plugin
Manual Backup
- Log into your WordPress hosting control panel.
- Under the “databases” section click on phpMyAdmin
- Make sure your WordPress database is selected inside phpMyAdmin (you will be able to see the list of WordPress database tables when it is selected).
- Once it’s selected, click on Export from the top menu bar.
- When asked to select “Export Method” select “custom”
- Include or exclude the tables you’d like
- In the “output” section select “Save output to a file” for compression select “zipped” or “gzipped”
- Scroll down and select “Go”
- You should receive the database export as a zip or gzip from PhpMyAdmin
Backing up your WordPress with a plugin
You can install a plugin for WordPress to backup your theme. There are a few to choose from such as BackWPUp, BackupBuddy, UpdraftPlus, BackUpWordPress, Duplicator.
Connecting your Google Analytics to your Premium WordPress blog
Once you’ve backed-up your theme, you can now go on and connect your Google Analytics to your blog.
Getting your Tracking code
- Log into Google Analytics to get your tracking code.
- To do this click on “admin” in the “property” column click “tracking info” and then “tracking code”
- Under “Website tracking” copy the tracking code
Adding the tracking code
- Log into your WordPress dashboard
- Go to “Appearance” and click on “editor”
- On the right hand side under “Templates” click on the “header.php” file
- Paste your tracking code you copied from your Google Analytics after the <body> tag
- Click “update file”
Congratulations! You’ve just added Google Analytics to your Premium account!
If that didn’t go quite as planned, don’t worry because you have your backup, which you can easily restore by following these simple steps