This guide explains how to use Beehive Pro to bring Google Analytics reports right to your site’s dashboard and, if you want, to the dashboards of every site in your multisite network.

Use the index on the left to quickly locate usage guidance on specific features.

If you haven’t installed Beehive yet, then you should visit the Beehive Pro page where you can explore the plugin’s features and where WPMU DEV members can install the plugin directly to any connected site.

Google Analytics Required

You need a Google Analytics account, which is free, to properly configure Beehive. If you need to create an account, the Get Google Analytics section of this guide will have you up to speed in minutes.

10.1 To Share or Not to Share

Link to chapter 1

Beehive can be connected to Google Analytics in two ways: by simply connecting to any Google account or by using the Google Analytics API to create a custom connection between your site and Google Analytics. We strongly recommend connecting with the Google Analytics API using the instructions provided in this guide.

When you use the simpler Connect with Google method, Beehive uses a hard-coded API that is shared by every user who connects the same way. Google limits the maximum number of requests a single API can make per hour and per day. A shared API significantly increases the chances of hitting this limit and distorting your stats.

Enabling the Google Analytics API, on the other hand, creates an exclusive connection just for your site or network. This custom connection ensures your stats will be as accurate as they can be, and it is virtually impossible for a single user or even a single multisite network to reach the Google Analytics API limit. See Limits and Quotas on API Requests for more information on the limits of shared APIs.

10.2 Guided Setup

Link to chapter 2

The guided setup is available the first time Beehive is opened, and we encourage users to follow it. Beehive can be configured in the Settings module also, as described in the Settings section below.

Before you begin, remember that you need a Google Analytics account, which is free, to properly configure Beehive. If you need to create an account, see the Get Google Analytics section of this guide first, then return here to proceed.

Choose a connection method

You must first decide what type of connection you wish to create between Beehive and Google Analytics. If you are unsure which connection method to select, see To Share or Not to Share.

NOTE:   If you want Google Analytics to track this site but do not want those stats available in WordPress, simply click Add Google Analytics Tracking Code at the bottom of the Welcome to Beehive popup and insert the Tracking ID in the field provided.

To unlock Beehive’s full potential, click Set Up API Project to create a custom connection with the Google Analytics API as we recommend, or click Connect with Google to use the shared API.

10.3 Set up API Project

Link to chapter 3

This section guides users through the process of creating a Google API project to support integrating Google Analytics with Beehive.

Before You Begin:

We recommend connecting your site to your Google Analytics account before you begin the API Project. If you need help with this, see the Create a Property section in the Get Google Analytics chapter of this guide.

Understanding API Projects

Google API projects are created in the Google Developers Console and involve configuring a Google API, or multiple APIs, to service websites, mobile apps and other applications. In this project we’ll be combining three APIs into a single, robust data collection and reporting profile that shares data with Google Analytics.

The APIs involved are:

The Google Analytics API allows those with established credentials to configure the data collection and reporting profile for a specific property (domain/site/nework).

The People API collects user profile and contact information for consenting users and shares that data with Google Analytics. This API can be enabled with a couple of clicks. No configuration is necessary.

The Google Analytics Reporting API allows authorized users to build custom dashboards in Google Analytics, automate complex reporting tasks and integrate with applications like Beehive. Like The People API, the Reporting API requries no configuration and is enabled with a couple of clicks.

Create a Beehive API Project

Begin by signing into a Google or G-Suite account associated with the site on which Beehive is being configured, then navigate to the Google Developer Console . If this is your first time accessing the console, agree to the Terms and Service to proceed.

Click Create to initiate a new project.

If you don’t see the Create button, this is probably not your first time in the Developers Console. Click the Select a Project drop-down and click New Project on the popup that appears.

Give the project a name. If you are using a G-Suite account, select the organization and location you want to associate with it, then click Create.

Enable the Google Analytics API

Click Enable APIs and Services to access the Google library of APIs.

Use the search tool to locate the Google Analytics API or scroll to the bottom of the page where it’s located and click Google Analytics API.

Cick Enable.

If you are prompted to create credentials, ignore the request and exit the prompt. Google requires OAuth 2.0 credentials for API connections, but it is better to add all the required APIs before creating those credentials.

Enable Google People API

Locate the Enable APIs & Services button. If you don’t see the button, click APIs & Services on the left side of the screen. Click Enable APIs & Services to access the Google API Library.

Type “people” into the search tool to quickly locate The People API, then select it and click Enable to add it to the project.

Enable Reporting API

Finally, add the Google Analytics Reporting API in the same way. Click Google APIs on the left and then Enable APIs and Services to return to the API Library.

Search for “reporting”, select and Enable the Reporting API.

Once the three required APIs are added to the project, it’s time to create the OAuth Client ID.

Create Consent Screen and Credentials

Google requires informed user consent for most of its data collection APIs. In the case of Beehive, Google requires an OAuth 2.0 Client ID which, in turn, requires that users grant consent to the data collection via a consent screen. First, we will configure the constent screen, then the Client ID.

OAuth 2.0 and Google Verification

OAuth 2.0 is a protocol intended to ensure users whose data is being collected and handed off to a third-party have consented to that transaction. Google requires sites to identify the data collection app involved and to verify that data is being collected in accordance with Google policies before granting OAuth 2.0 credentials. Depending on the sensitivity of the data or the API involved, Google may require an application and its consent notification to submit to a verification process before providing those credentials. See the Scopes section of this guide for more information about that verification process.

There are many routes through the OAuth credential screens, but the following path is the most direct.

First, navigate to your Google API Project Dashboard by clicking Google APIs in the upper left corner. Once there, click the Credentials tab.

In the popup that appears, click the Create Credentials drop-down menu and click the OAuth client ID link.

Configure the Consent Screen

Google requires users consent to having their data collected via a popup consent screen, and requires Admins to provide information that will appear on that screen.

Click Configure Consent screen to proceed.

Depending on the user data being collected and its intended use, some Admins may be required to provide more information than others. Beehive Admins are required to identify the type of data being collected, the application’s name, an email address for support requests and an authorized domain.

This is an example of what a configured Beehive consent screen looks like.

The following guidance will help you complete the required consent screen fields.

Application Type – Beehive will be collecting public data, so select Public, if it isn’t already selected.

Application Name – This name that will appear on consent screens indicating who is requesting users’ data. Google requires that the name accurately reflect your application and be consistent with the application name users see elsewhere. You can include your site or company name with the application name, but be careful not to use a name that suggests your application is from Google or any entity other than your own.

Support email – By default, the Google account you signed in with will appear as the support email. Later, you can create a user with an email address specifically for support requests.

Scopes for Google APIs – We do not recommend adding scopes to your Beehive API project. If you require additional scopes, see the Scopes and Verification section below before adding them. Otherwise, no action is needed in this section.

Authorized domains – Type your domain name into this field and hit return. Google requires that authorized domains be top-level domains only, such as example.edu, mysite.com, etc. Subdomains, such as analytics.example.com, cannot be an authorized domain; however, once an authorized domain is added, Admins can use any of its subdomains or pages elsewhere, as needed. Enter your domain into the field provided, and if it is accepted, the domain name will appear above the field.

When ready, click Save to preserve the information and exit the page.

In the popup that appears, click the Create Credentials drop-down menu, and select the OAuth client ID link.

Create Client ID

Complete the Create OAuth Client ID form as instructed below and click Create.

Application type – Select Web application and a series of settings relevant to web applications will appear.

Name – Here you are actually naming the credentials associated with this project. The name can be anything that works for you.

Authorized Javascript origins – All the javascript required for Beehive to function is contained in the app, so Admins can ignore this field.

Authorized redirect URLs– Enter the URLof the site being connected here. Be sure to include a slash ( / ) at the end. Other URLs may also be added. See the note below for important information regarding redirect URLs.

IMPORTANT NOTE REGARDING REDIRECT URLs

Be sure the Redirect URL contains a slash following the final component, like this: https://www.example.com/.

When you are ready, click Create and Google will generate your credentials.

Your OAuth 2.0 Client ID will be created and displayed, while the Secret Key is still a couple of clicks away. Click Done to proceed.

Locating Your Client Secret and Client ID

The Credentials screen contains a list of the Client IDs for all your Google API projects. Each Client ID will have an associated Client Secret, which can be viewed by clicking the name of the project or the Edit icon.

When you open the Client ID page, the Secret Key may not appear immediately. If not, simply refresh the page, and the key should appear beneath the Client ID.

The Client ID for this project cannot be changed, but users can reset the Client Secret as necessary by clicking Reset Secret.

Return to the Hive

Return to your site and copy/paste the Client ID and Client Secret into their respective fields in Beehive and click Authorize.

You will be asked to log in to the API project and grant permission for Google Analytics to collect data from this site. Login with the Google account used to create the project.

Click Allow in the pop to confirm the connection between Beehive and Google Analytics.

Congratulations! Your site is connected to Google Analytics with a robust data collection and reporting profile. It may takes several minutes for data to begin appearing in your Dashboard. In the meantime, there are a few more steps required to complete the Beehive configuration.

PRO TIP

You can create multiple Views for each property (domain/site/network) in Google Analytics. Multiple Views allow you to create more narrowly tailored reports, which has the added benefit of cleaning up the data as Google separates it from the rest.

Setup Your Account

Now that Beehive is connected, just a few housekeeping tasks and you’re done. First, you will establish which roles will able to view the Google Analytics data and reports that appear on your dashboard and in Beehive.

From the drop-down menu select the View, formerly profile, associated with this site. Below that, ensure the Automatically Output my Google Analytics Tracking Code is enabled. In the list below that, select the user roles allowed to access analytics data and reports.

When the Finishing Up screen closes, the integration will be complete.

Congratulations! You have successfully integrated Google Analytics into your site with Beehive.

10.4 Connect with Google

Link to chapter 4

To use the shared API, rather than the custom API we recommend, click Connect with Google in the Welcome to Beehive screen or the Settings module in Beehive.

Choose the Google account you wish to use to connect Beehive with Google Analytics.

Remember, a property for the site or network you are connecting must exist within that account for Beehive to work properly.

PRO TIP

You can create multiple Views for each property (domain/site/network) in Google Analytics. Multiple Views allow you to create more narrowly tailored reports, which has the added benefit of cleaning up the data as Google separates it from the rest.

Click Allow to authorize Beehive to access your Google Analytics account.

Beehive is now connected to your Google Analytics account, but it needs to know what property owns the data it collects from the newly connected site. The drop-down menu contains a list of the properties that exist within the connected account. Use it to select the correct property.

Select the user roles who will have access to the Beehive Analytics reports for this site or network, then click Continue.

When the setup is complete, Beehive will begin feeding data to the selected property within your Google Analytics account.

10.5 Connecting a Multisite Network

Link to chapter 5

Each subsite in a multisite network must be connected individually, but if Beehive is installed, network activated and connected in Network Admin using the Google Analytics API, we will use that custom connection for the entire network. This allows subsites to connect with the fast and easy Connect with Google method but still reap the benefits of a custom API connection.

NOTE:

If you are unsure why we recommend creating a custom connection, see To Share or Not to Share

.
The steps for connecting Beehive to Google Analytics for a multisite network are essentially the same as connecting a single site, although multisites have a couple of unique options after the connection is complete. Take a moment to familiarize yourself with them now, or return to this section when you are ready to configure these options.

When you’re ready, go to Guided Setup to begin configuring Beehive, and remember to configure the plugin from Network Admin before connecting any subsites.

Granting Permission Authority

After connecting Beehive to Google Analytics in Network Admin, you will be given a chance to determine what users can access the analytics data. This setting applies to the Network Admin site only. Enable Allow subsite admins to overwrite this setting, and subsite admins will be able to choose for themselves who sees their sites’ data.

Tracking Admin Pages

By default, analytics data for each network site is displayed on that site’s dashboard only. However, by enabling this Admin Page Tracking feature, data from every site will be shared with the Network Admin site as well.

Click Finish to complete the initial setup.

Beehive is now connected to your Network Admin site, and you can now begin connecting subsites using the Connect with Google option.

Connecting Network Subsites

If you followed our advice and connected the network using the Google Analytics API and did so from Network Admin, every subsite can now connect using the simple Connect with Google method.

Begin by navigating to any subsite.

You should see a notification that the site is not yet connected to Google Analytics. Click Connect Account.

From this point on, follow the process discussed in Connect with Google section.

10.6 Settings

Link to chapter 6

If you skipped the Guided Setup or need to make changes to Beehive at some later date, you can do so in the Settings tab.

The Settings tab has three modules: Settings, Tracking Code and Permissions.

Settings
Account

Connect the Google Analytics API by copying and pasting the Client ID and Client Secret into the applicable fields.

See Set up API Project to obtain the credentials required to connect with a custom API, or see Connect with Google to connect with the shared API.

NOTE:   If you are unsure which connection method to select, see To Share or Not to Share

Admin Tracking Pages

By default, analytics data for each network site is displayed on that site’s dashboard only. However, by enabling this Admin Page Tracking feature, data from every site will be shared with the Network Admin site as well.

IP Anonymization

Google does collect IP addesses in order to report geolocation data, but those address are never reported and are stored in an anonymous state.

When enabled, IP Anonymization feature further modifies collected IP addresses and allows your to ensure your audience that you are not leaving it up to Google to protect their data.

Display Advertising

When enabled, this feature adds Google advertising cookies to your site or network so you can do things like:

Create Remarketing Audiences based on specific behavior, demographic, and interest data, and share those lists with Google Ads

Use demographic and interest data in your Analytics reports

Create Segments based on demographic and interest data

Keep in mind that you may need to update your privacy policy if you wish to enabled this feature.

Tracking Code

The tracking Code referred to here is the Tracking ID that Google assigns to a property when it is created in Google Analytics. This code identifies that property so Google knows where to send the data it collects from this site or network.

Only one tracking ID can be applied to a site, so if you later want this site’s data compiled in a different Analytics property, you will need to obtain and change the code here.

Permissions
Roles

Here you can determine who can see the data and reports compiled by Google Analytics. On multisite networks, the roles enabled will apply to every site in the network unless the Allow site admins to overwrite this setting is enabled.

Capabilities

Capabilites are an extension of the Roles feature and allows SuperAdmins to delegate control over subsites in highly specific ways.

Access the WordPress list of commands and apply those commands in the field provided to craft custom roles with capabilities defined by you.

10.7 Get Google Analytics

Link to chapter 7

This section guides users through creating a Google Analytics account and a property within that account that Beehive can connect to during configuration.

Since you don’t have an account, perhaps you don’t know how Google Analytics works. Here’s the short version: Google Analytics, using javascript, tracks what users do on your sites—what links they click, what pages they view and for how long and many other data points as well.

Google can do this because users—that’s you—insert custom code into the code for every page they want tracked. The tracking code tells Google know who owns the data collected from a given page so it can be associated with the right account in Analytics. The data is then categorized based on a myriad of variables—many of which can be customized in Beehive—and finally are displayed as reports on site dashboards that admins can use to plan and achieve site or network goals.

It may be helpful to also understand how a Google Analytics account is structured. There’s the Account, of course, and within each account there are properties and within each property there are Views.

Here’s how Google defines each:

Account: Think of it as the top-level folder that you access using your login details. If you are managing a single website, then one account is sufficient. If you’re managing multiple websites that aren’t directly related, then these should be stored in separate accounts. Google allows users to create up to 100 accounts.

Property: A “property” is simply Google-speak for a website or network of sites that have been added to a Google Analytics account. When Beehives connects, it connects to a specific property. Each account can have up to 50 properties.

Views: Views tell Google Analytics what reports should be created for a given property. In simplest terms, each view is a separate report. A default View called All Website Data is defined for each property when it’s created. Users can create up to 25 custom Views, each targeting a unique traffic factor or group of factors, as defined by the user.

PRO TIP

You can create multiple Views for each property (domain/site/network) in Google Analytics. Multiple Views allow you to create more narrowly tailored reports, which has the added benefit of cleaning up the data as Google parses it to fulfill your request.

Sign Up

Ensure that you are logged in to a Google account with admin privileges on the site or network you wish to connect with Beehive. Browse to the Google Analytics Setup page and click Sign Up.

By the way, if you clicked the Google Analytics Setup Page link above, and it opened an Analytics Dashboard, then the Google account you’re using already is associated with an Analytics account.

If you wish to continue with the same account, simply open the Admin panel, click Create Property and jump down to the Create a Property section of this guide.

Create Account

Create your first Analytics account by simply giving the account a name and then choosing what, if any, of your collected data you want to share. Click Next to proceed.

Click Website to tell Google what type of analytics the account will require.

Create a Property

In the next step, you will be creating the first property associated with the new account. During this initial setup, Google makes a property setup screen available. In the future, you can create properties by logging into Google Analytics and accessing your Admin panel.

Enter the site or network URL, choose an industry category and time zone, then click Create.

If the Google Analytics Terms of Service popup appears, click Agree to proceed.

Tracking IDs and Codes

Once the property is created, Google will display the Tracking ID and Global Site Tag, known as the tracking code, for that property.

These codes must be present on every page of every site  you want Google to track, but fear not, Beehive has this tedious task covered.

Once Beehive is connected to a property in Google Analytics, it automatically adds the codes to every page on that site, eliminating the need for users to edit page code.

Congratulations! You now have a Google Analytics account and a property waiting to connect with Beehive. Go to Guided Setup to begin connecting and configuring Beehive.

10.8 Scopes and Verification

Link to chapter 8

We do not recommend adding scopes to your Beehive API project. OAutho 2.0 verification is sufficient for the three scopes employed by Beehive and results in essentially immediate approval of your application by Google.

The data collected by Beehive requires three scopes:

userinfo.profile – Collects publicly available personal information.
userinfo.email – Collects users email addresses.
analytics.readonly – Shares analytics data with a client service, in this case Beehive.

Adding scopes to your Beehive API project can broaden the type of data collected, but doing so may also trigger a higher verification standard that prevents immediate creation of the required credentials or places limits on Beehive until the verification process is complete. The verification process for highly sensitive scopes can take weeks.

NOTE

If you are considering adding scopes to your Beehive API project, see the Scopes and Verification section of this guide before doing so.