Google Analytics and the Commons
The Commons has Google Analytics running on the whole site to gather statistics and metrics. If you want to get statistics for your site on the Commons, contact us at email@example.com, and we’ll set you up with online access to review statistics, and/or daily, weekly, or monthly reports, sent to your email. Activity is provided in a spreadsheet or PDF, and can be broken down many ways, including by Pageviews, Unique Pageviews, Average Time per Visit, Bounce Percentage, and Exit Percentage. Google seems to be constantly changing Analytics, and there seems to be a lot of new stuff constantly appearing.
There are a couple other ways to gather the kind of information – check out Statistics For Your Site for alternatives.
This documentation is for the Commons Community team, and others who have been granted admin privileges to Google Analytics for the site. Users with basic access will not be able to do many of the things below, but are invited to read on, if interested.
Where Am I?
It is confusing at first (and even afterwards) to figure out where you are in the Google Analytics API. Basically, you can be looking at the whole site and control admin and users from there, or you can go into a “view” and edit settings and set up reports for that sliver of data. There are many views or subdomains (aka blog sites) listed, including one view of the entire site (commons.gc.cuny.edu). A good way to tell where you are is to look at the top right corner of the page.
The screenshot above shows two examples of what would display in your top right corner when you are looking at: (1) the whole site, and (2) at one view called “Digital Labor”. It is easy to think you are looking at the whole site, when in fact you are only in one view.
Typically, we assign permissions based on subdomains, but some users will be assigned permissions for the entire site. There are four levels of permissions, and they can be assigned on the whole Commons site, or on the subdomains level.
If assigned at the subdomains level, you will see “None” in the screenshot below, which is found at Admin>>User Management:
If you click on a user’s email, you will be taken to a screen that shows the permissions assigned on a subdomain level. In the screenshot below, we are looking at the permissions assigned to Anthropology Fellows. As you can see, these individuals have access to two subdomains and can collaborate, read and organize:
To add a User, you only will need his or her valid gmail address. You should encourage members who want to use this tool online to get a gmail account. Other email addresses can be problematic.
Creating Views and Filters
To isolate and report on the statistics of a particular blog, we need to do two things – create a “view” and create a “filter” (you can call it anything, but mostly we just call it by the same name). The filter strains all the metadata – typically we use these parameters: “include only“, “traffic to hostname“, “that begin with“. That way when we create the filter, we can input the hostname as the sub-domain address (“xxxx.commons.gc.cuny.edu”) and effectively filter out any traffic that is not going there.
Here is a screenshot that shows how to create a view.
Once you have created a view, you need to filter it display the stats you want see. Without a filter, you’ll see all visits to the Commons. Be careful here – syntax counts. No “http//” or trailing “/”. That will mess up your outcome.
Once you’re done, you might want to visit the “view” site and see if you are getting counted. It takes awhile – maybe a couple hours – but if you’ve done it correctly, you should see some uptick in the blue line. The standard reports are based on monthly totals, so it really takes a month to get any meaningful stats.
Getting Historical Data
A view only starts filtering out data from the time it was created. How can you get statistics to subdomains prior to view creation?
First, go to the Commons view. This is the view that was created when the Commons was first set up on Google Analytics, and it has compiled all our data since then.
We will need to create a customized report based on this data. Click on “Customization” highlighted in the red box and then “New Custom Report” to get the process rolling.
On the new report page, you’ll need to supply a report name, and some metrics you want to report on. To see all metrics possible, check the “Display Options Alphabetically.” This will make it a lot easier to see the possibilities. A good metric to start with is “Visits.” You can always add or subtract metrics later.
Next you will probably want to choose “HostName” as your dimension if you want to report on one or all subdomains.
Next you will probably want to filter by one or more subdomains. You can set up the filter to exclude or include. Usually you will pick “Include” and “Exact” and then just provide the name of the subdomain. The API will prompt you. You can enter several includes, or if you know regular expressions, you can use one or more to filter down to exactly what you are looking for.
When you save your report, your data will display after a couple seconds. You can adjust the timeframe at this point. You can set the report to begin and end on certain dates, and you can report by day, week, or month. These controls are found on the actual report and can be changed dynamically. “Line Chart” is the default, but you can also choose “Motion Chart” to animate the data. Line Charts can be exported to a variety of formats.
This is just a quick start for Google Analytics on the Commons. There are obviously hundreds more options.
Here is an experimental report that I played around with for “Helldriver’s Pit Stop.” It has four tabs with different report metrics.