Custom Data import example

Learn how import and analyze types of data for custom purposes.

Google Analytics provides a number of import types designed to support specific common use cases. Before you decide to implement Custom Data Import, be sure your use case isn't already covered by one of the other types. Learn more about the types of data you can import.

Custom Data Import is a kind of "catch all" that allows you to import and join data in ways that make sense to you. The basic concepts, steps and limitations of Custom Data Import are the same as for other import types; however, you have more flexibility in the choice of key and target dimensions.

Start by thinking about what reporting you want to add in your reports and analysis. If this information isn't already collected by Google Analytics and it's not handled by one of the other data import types, you can use the Custom Data Import type to join this information with your Google Analytics data. You can then create custom reports to view the imported data along side standard Google Analytics data.

In this article:

Scenario:

You are engaged in an affiliate marketing program and want to track and analyze your site usage by affiliate traffic segments.

Step 1: Decide what data to import.

For the affiliate marketing example, you might want to import data such as the affiliate's geographic location, and assign categories and types to affiliate-related hits to your site.

Step 2: Create any necessary custom dimensions or Metrics (Universal Analytics only)

If you need to import to dimensions or metrics that are not already provided in Google Analytics, AND if you have implemented Universal Analytics (analytics.js), then you should create new custom dimensions and/or Metrics (e.g. "Author") and import using them.

Example:

To join your imported data with hit data captured by Google Analytics, you might create an Affiliate ID dimension. You could extract this ID from the query parameters of URLs that send this affiliate traffic to your site.

Step 3: Create the Data Set

A Data Set is a container that holds the data you upload to Google Analytics. The Data Set schema defines the structure that joins the data you upload with the existing data in your hits. You manage your uploaded data files using the Data Set. Data sets are associated with views, giving you flexibility in how you include imported data in your reports.

Example:

To upload the data for your affiliate marketing program, create a Data Set to hold that specific information. The Data Set schema would define a key, perhaps using a custom Affiliate ID dimension and import dimensions for metadata such as Affiliate Geo, Affiliate Category, etc. Then, you can upload affiliate information as needed to that Data Set.

Step 4: Upload Data

There are two ways to upload data: manually, using the Google Analytics web interface, and programmatically via the Management API's Uploads resource. In either case, you'll need to create a properly formatted CSV file containing your data. The CSV files are usually created by downloading data from a 3rd party vendor or are generated by hand (for example, from a Google Sheets document). You will need to add the proper header row, with the names of the dimensions and metrics specified by their internal ga. names.

Example:

You are uploading affiliate data, using the dimensions specified in your Data Set (see above). The CSV file header would list these using names similar to these (where dimension 1 is the affiliate ID, dimension 2 might be affiliate geo, dimension 3 might be affiliate category, etc.):


    ga:dimension1,ga:dimension2,ga:dimension3
    A101,Midwest,"Wine & Food"
    A101,Pacific,"Wine & Food"
    A222,East,Sports

Step 5: View data in reports

Data you upload using the custom import feature can be included in Custom Reports.

Example:

You've uploaded affiliate category data and want to see the total number of pageviews per category. To do this, you would create a custom report with one metric (Pageviews) and one dimension (affiliate category).

Uploaded data needs to be processed before it can show up in reports. Once processing is complete, it may take up to 24 hours before the imported data will begin to be applied to incoming hit data.

Real-Time reporting not supported

Real-Time reports do not display imported dimensions.

How helpful is this article:

Feedback recorded. Thanks!
  • Not at all helpful
  • Not very helpful
  • Somewhat helpful
  • Very helpful
  • Extremely helpful