Connect Your Site With Google Analytics

REW Travis L posted this - 4,038 Views

Update: Google recently made some changes on their end, and as a result the method we use to connect to their API has been updated. The tutorial below reflects the new process.

Google Analytics is a free service offered by Google that shows you how users have found your site and how they have explored it. This service tracks visitors and has the ability to keep track of marketing campaigns.

The tutorials below will go over setting this up:

Google Analytics Tracking ID
Google OAuth Client ID

Google Analytics Tracking ID

In order to connect your website to your Google Analytics account, Google Analytics provides you with a Tracking ID that will need to be placed onto your website - this is done by placing the Tracking ID into the Google Analytics UACCT Number field in the backend under CMS > Tools > Tracking Codes.

1. Log into your Google account
2. Sign up for Google Analytics
3. Create a new Analytics account
4. Get your Tracking ID
5. Add your Tracking ID into the backend


1. Log into your Google accountBack to top

Go to this link http://www.google.com/analytics/ and click Sign in > Google Analytics. You will then be brought to the next screen to log into your Google account. These links are in the upper right corner:

     


2. Sign up for Google AnalyticsBack to top

You should be redirected to a Google Analytics signup page (https://www.google.com/analytics/web/) - click Sign Up to continue and proceed to Step 3:

***The following section only applies if you were already signed up to Google Analytics… if you had the Sign up button shown above, skip the rest of this section and proceed to Step 3.***

If you were already signed up for Google Analytics, you will instead been taken to your Analytics homepage. If so, click on Admin from the top navigation:

Next, click on the Account dropdown and select Create new account:


3. Create a new Analytics accountBack to top

Fill out the New Account form:
-    Select Website at the top
-    Choose an Account Name and Website Name (these can be named however you would like).
-    Enter the Website URL as www.yourdomain.com and ensure http:// is selected
-    Select the appropriate Industry Category (optional)
-    Select your Time Zone
-    It is up to you what to select for the Data Sharing Settings – read their documentation for more information regarding this (these settings will not affect the setup)
-    Once it is all filled out, click the Get Tracking ID button at the bottom

 

 

 

You will then need to accept the Google Analytics Terms of Service Agreement to proceed:

 


4. Get your Tracking IDBack to top

You should be redirected to the Tracking Codes page which will display the Tracking ID for your site:

You can get to this page by clicking on Admin from the top navigation, selecting the appropriate Account and Property from the dropdown menus, clicking on Tracking Info, then Tracking Code:


5. Add your Tracking ID into the backendBack to top

Copy and paste your Tracking ID into the Google Analytics UACCT Number field of the Tracking Codes section in the backend of your website. (CMS > Tools > Tracking Codes) and click the Save Changes button in the top-right.



Congratulations! You should now be able to view your website statistics within your Google Analytics account. Please refer to their Analytics Help Center for information regarding using Google Analytics: https://support.google.com/analytics/

Proceed to the next tutorial to set up an API Key necessary in order to access the Google Analytics data from the Reports section of the backend.


Google OAuth Client ID

In addition to monitoring your site statistics directly within your Google Analytics account, you can view the Google Analytics details for your website in the backend under the Reports tab. In order to do this you will need to add a Google API key to the backend under CMS > Tools > Tracking Codes

Completing this section will also set up the Google IDX Social Connect, allowing visitors to sign up on your site using their existing Google accounts. For more information regarding IDX Social Connect, visit: http://www.realestatewebmasters.com/support/idx-social-connect.php

Also, if you previously had the Google section of the IDX Social Connect completed, these fields may already be filled in and you can skip ahead to 5. Access Google Analytics

1. Log into your Google account
2. Turn On Analytics API
3. Create an OAuth Client ID
4. Add the Client ID and Client secret into the backend
5. Access Google Analytics


1. Log into your Google accountBack to top

Go to this link https://code.google.com/apis/console#:services and log into your Google account

If you are not already logged in you should see...

You will need to sign in or create an account to continue. If you are already logged in proceed to the next step.


2. Turn On Analytics APIBack to top

Once you login you will be presented with on screen pop-up prompts, click "NEXT" on the first two and "DONE" on the third prompt. You will then arrive on the API Library page, where you will be able to manage your APIs (Note: you should already be seeing the API page; if not, you can reach this page by clicking on the Google APIs tab found in the top left. If instead you see a big Create project button, click on that to get started).  



Search for Analytics API and click on it.

Once you select the Analytics API you will be presented with the screen to enable the API. Before you can enable, you must create a project for this API setup. Click Create Project.

Next you will be on the Create a Project screen, from here you will enter in a Project Name (If you have already created a project just select the project from the list.) Once you have filled the required fields you will need to select Create.

 

Next you will either see a Disable API or Enable API button near the center of the screen. If you see the Enable API button, click on it to enable the Analytics API (you may need to agree to some terms at this point). If instead you have the Disable API button, the Analytics API is already enabled and you can move on to the next step. As soon as you select Enable a message will appear below it and you will need to select Go to Credentials.

 

 


3. Create an OAuth Client IDBack to top

With updates and changes to Google API Manager there are now two ways to create a OAuth Client ID. If you followed the above steps and selected Go to Credentials then proceed with the following instructions. If you did not select Go to Credentials then click here for the secondary options.

 

Step 1) The next page you are brought to is where you will enter the type of credential you need. Make sure you have Analytics API selected, next use the drop down to pick where you will call the API from, select Web browser (Javascript). The data you will be accessing is User Data, check the checkbox to the left of User Data. Select What credentials do I need to continue to the second step.

 

 

 Step 2) The next step will require you to give the Client ID a name, as well as set the URL Restrictions. You will find the required URL's on the backend of your website under CMS > Tracking Codes.  Match the

 

 3.a Create Client ID (Configure consent screen)

You should then see the Consent Screen settings which will need to be completed in order to proceed. You only need to select your email address and enter in a Product name, and then click Save (you can complete the "More Customization Options". This will be visible to people when signing up on your site using their Google account.)

3.b Create Client ID

Once you have the Create Client ID screen up, enter in the following information:

Application type: Web application
Name: Your Name
Authorized JavaScript origins and Authorized redirect URIs: Replace the default text with the Javascript origins and Redirect URIs found in the backend under CMS > Tools > Tracking Codes under the Google API Settings section.

Click on the Create Client ID button


4. Add the Client ID and Client secret into the backend

You will now have a new Client ID for web application, with a Client ID and Client secret needed to complete the setup. Copy this information into the backend under CMS > Tools > Tracking Codes into the Google API Settings section, and click Save Changes


5. Access Google Analytics

In the backend of your REW site head to the Reports section. From there click on the Access Google Analytics button, this will bring you to another page where you will need to select Connect to Google Analytics, this will prompt a final confirmation page where you will select Connect to Google Analytics one more time. If a pop-up does not display on your screen then look for a blocked pop-up and allow to proceed.


Now, you just need to click on Accept to complete the setup.



Congratulations! You should now be able to view Google Analytics through your CMS backend under the Reports tab.


Comments

Enjoy this post? Why not share with friends or add a comment of your own?

Andre Perez

Great tutorial Alex. Do you know how to change the name reflected on REW's backed? Since I have multiple sites, the dropdown shows 4 options as "Google Analytics View (profile) All Website Data". I would love to identify each report API from the drop down menu. Thanks

REW Alex M

You can edit the name that shows up in the Google Analytics Profile dropdown menu in the backend from within your Google Analytics account. We are using the View name, which by default they set to 'All Web Site Data'.

Log into your Google Analytics account, head to the Admin section, select the desired Account, Property and View, and then select View Settings. From here you can change the View Name which we will be use in the backend.

Matt Martin

Hi Alex,

Thanks for the article. When I try to set up my analytics account in the backend, I get an error message saying that OAuth 1.0 is no longer supported and that I must migrate the app to OAuth 2.0. Any insight as to how to proceed?

Thanks and much appreciated,
Matt

REW Alex M

Hi Matt,

Google recently discontinued OAuth 1.0 which we were using to connect to Google Analytics. We are updated our code and will be rolling out the new changes to as many sites as we can automatically.

I've put a ticket in for your site and once we have the patch ready we'll work on updating your site.

Although we will be working on updating as many sites as possible automatically, some sites will not be able to be patched that way. If anyone is having issues connecting to Google Analytics please contact our support team at support@realestatewebmasters.com or 1-877-753-9893 and we will open a ticket to look into patching your site.

Matt Martin

Thanks for the info Alex!

Share your thoughts…