A common question about web content is “what was the last place visitors were before this page?” This information is normally found in the Analytics Dashboard (Beta), but you can also answer this in Google Analytics.
To get this data, we’ll make 2 reports: One to check which Mass.gov pages visitors were on previously, and another to check which websites or sources beyond Mass.gov – search engines, other state web applications, etc. – sent visitors. Unfortunately, Google Analytics does not allow us to combine these reports in its interface; this is one reason we created the “previous page” report in the Analytics Dashboard, which does allow us to mix the data.
Here’s what you’ll need to do to look up where visitors came from. Before we begin, make sure you have:
The URL(s) of any page(s) you want to look up
You should see an indicator that you’re looking at the mass.gov (Drupal) property in the upper left.
Under the "Customization" tab in the menu on the left of your screen, select "Custom Report" and then click on the button that reads "New Report."
Here’s how to configure a report that says which Mass.gov pages your visitors found your content from:
For report type, choose “flat table”
For dimensions, add “previous page path” and “page.” To do this, click “add dimension” and use the search box to narrow the options
For metrics, choose “unique pageviews”
Your new report will look like this:
At this point you can title your report (using the “Title” field at the top) and click “save.”
Repeat step 2 to create a second report. Then, configure it like this:
For report type, choose “flat table”
For dimensions, add “source,” “referral path,” and “landing page”
For metrics, choose “sessions”
This report will look like this:
Give your report a title and click “save.”
Once you have created your reports, you can filter them to get data about only the page or pages that you need to analyze. To do this, re-open either report from the custom reports menu (Customization -> Custom Reports) by clicking on the report title.
To filter for your page(s), click “advanced” (at the right of the screen) to show filtering options. Just pasting your page's URL in the search bar won't work.
A menu will open that lets you set up filters. You will want to choose either “page” (for the first report we created, on Mass.gov traffic) or “landing page” (for the second report, on offsite traffic).
Paste in the page’s URL without the host name. For example, if you want to see data about https://www.mass.gov/info-details/writing-for-massgov, you would paste in:
If you want to look up more than 1 page, first change “containing” to “Matching RegExp” and paste in a list of URLs without hostname separated by vertical pipes(“|”). For example, if you wanted to look up https://www.mass.gov/info-details/writing-for-massgov and https://www.mass.gov/info-details/massgov-style-guide, you would create the following filter:
After you’ve created your filter, click “apply.”
You can copy and paste the filter you made into your other report, too – just remember to change “page” to “landing page” (or vice versa if you started with the second report we made)..
Filtering by multiple pages at once is most useful if you plan to pull the data out of Google Analytics and into a spreadsheet. If you plan to use the data in Google Analytics, you may want to filter for one landing page at a time.
One other tip: When exporting a report to a Google Sheet or CSV, Google Analytics only exports the rows you’re viewing in the interface (which defaults to 10). If you want to see more data, make sure you use the “show rows” dropdown at the bottom of the report to set the number of rows you want.