WP Client Reports

Deliver professional client website maintenance reports

Set up Google Analytics

Setting up the integration for Google Analytics has a number of steps, but if you follow the directions below you should be able to set it up without an issue. In large part this is due to the complexity of Google’s products and the requirements they have.

We opted for the Service type of integration rather than a simple OAuth integration. This has a few more steps, but is far less likely to break and also is not confusing for our users about what analytics data of yours we would have access to (none).

If you are less concerned with security, you can save yourself time by re-using the service account across multiple websites. This would mean you only have to do the last two “sections” of this for each site.

Prerequisites:

  • This assumes that you have a Google Analytics account already set up, and that you are already tracking data on your website using it. This plugin does not add the necessary tracking tags on your website for Google Analytics to work. That is the job of another plugin.
  • You will need to have the ability to manage users on the Google Analytics account! This allows you to add the necessary user to the account. If you only have read only access, you will have to ask the owner to give you that permission or add the service account email address we create below for you.

Create an API Project

  1. Start by navigating to the Google Developers Console and Log in using your Google account.
  2. Once you are logged in, you’ll want to create a New Project. In the header, to the right of the Google APIs logo is a dropdown menu. Open that and select New Project.
  3. Enter a Project name and click Create, this will take a few seconds to finish. When it does finish make sure to click into that project so that it says the project name in the header.

Enable 3 Google Analytics API’s

  1. From the top left Hamburger Menu, choose APIs and Services and choose Library.
  2. Search for “Google Analytics“. Enable all three of these API’s:
    • Google Analytics API (Required for V3 Properties)
    • Google Analytics Data API (Required for V4 Properties)
    • Google Analytics Admin API (Required for V4 Properties)

Create a Service Account & Key

  1. Click Credentials or Create Credentials.
  2. Choose Service account.
  3. Name the service account. It could be “Website”, or the name of your website, or it could be WP Client Reports Plugin. Whatever you choose. Optionally add a description. Click Create.
  4. You do not need to set up any service account permissions or roles. Click Continue.
  5. You do not need to grant any users access to this service account.
  6. You do want to create a key! Create the JSON type key, it will download a file like funky-uncle-687965-456hsdfk5e6thdfg.json to your computer.
  7. Click Done.
  8. This is important! You are not done yet! Copy the service account “email address” that you just created and keep it for the next step. It will look like wpclientreports@funky-uncle-687965.iam.gserviceaccount.com depending on the name you gave to it and the random names/numbers it assigns.
  9. If you are less concerned with security between accounts (this will only be for read-only data), you could re-use this same account for all of your sites.

Add Account to Google Analytics

  1. You will now log in to your Google Analytics account.
  2. Once logged in, choose the website you want to give access to by using the menu to the right of the Analytics logo.
  3. Click admin in the bottom left corner.
  4. Under account, choose Account user management.
  5. Click the blue plus button in the top right corner to add a new user.
  6. Paste in the Service account email address you created earlier. All it needs is Read & Analyze permissions and click Add.

Upload Key File to WP Client Reports Pro

  1. Log in to your WordPress site and go to Settings > WP Client Reports.
  2. Enable Google Analytics and click Save.
  3. Upload the .json key file from steps above and click Save.
  4. You may need to select an account and click Save.
  5. Choose which property/view you want to use.