Look up sources of pageviews

You can look up the data on previous page traffic that is usually found in the Analytics Dashboard (Beta) using Custom Reports in Google Analytics.

Introduction

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:

Step 1: Log in to mass.gov (Drupal) Google Analytics property

You should see an indicator that you’re looking at the mass.gov (Drupal) property in the upper left.

Step 2: Create a new custom report

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."

Step 3: Set up a report for which Mass.gov pages your visitors came from

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.”

Step 4: Set up a second report to learn about sources of traffic beyond Mass.gov

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.”

Above, we recommend using “source,” which shows the name of the site or asset that’s sending you traffic, such as “google,” “email_newsletter,” or “facebook.” You might also want to use “medium,” which groups sources into broader buckets: “organic” for all search engines, or “social” for social media.

There is even a “source/medium” metric that shows both at the same time. Consider trying different versions of this report using “source,” “medium,” and “source/medium” to see which works best in different situations.

Step 5: Use filters to look up data about a specific page or pages

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:

/info-details/writing-for-massgov‌

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:‌

Includes Landing Page Matching RegExp /info-details/writing-for-massgov|/info-details/massgov-style-guide​​

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.