17 Data Import and Measurement Protocol

Thus far in the book, the discussions about Google Analytics (GA) data capture have centered around the GA JavaScript tracking code, analytics.js. Whether placed on the page directly or deployed through Google Tag Manager as we have demonstrated and recommended, tracking code execution tends to be our primary mental paradigm for GA data capture. In Chapter 14, we also worked with the Android and iOS SDKs to record mobile app data into GA.

In this chapter, we look at the two options beyond analytics.js and the SDKs for getting data into GA: data import (through the GA user interface or through the API), and the Measurement Protocol (MP), which allows any programmed, networked environment to push hits into GA in the form of basic HTTP requests.

We’ll use data import in most cases to add dimensions to analytics.js and mobile SDK hits; using the Measurement Protocol, we’ll record new hits.

Data Import

The data import feature in GA may seem somewhat complicated at first, but it’s actually quite straightforward and very flexible. In each case, you’re generating a .csv (comma-separated values) data file and importing built-in or custom dimensions against a common key in GA.

Several data import scenarios are outlined next.

Get Google Analytics Breakthrough now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.