Importing Campaign Data using the Management API

This guide describes how to import campaign metadata such as source, medium,
content, referral path, and other custom campaign data.

Introduction

Importing
campaign data into Google Analytics enables a more customized
analysis of campaign performance. It allows you to include data such as new
campaign classifications and variations, in addition to the standard Google
Analytics
campaign tracking
parameters.

It also simplifies and reduces the amount of campaign data you need to send
in the tracking code. A single campaign ID sent to Google Analytics at
collection time can be joined with your imported campaign data to populate
campaign and custom dimensions and metrics in your reports.

Overview

Set campaign information

Setting campaign information for a user is required in order to allow
imported campaign data to be available for analysis. You can do this by
setting the campaign code/Id which will be used to join your
imported data.

Option 3 (analytics.js): Plugin with custom campaign tracking

If you are not using the utm_id in your URLs to track your
campaign Id, you can follow the example in the
Plugins - Web Tracking (analytics.js) developer guide which shows how
to capture custom campaign values from a page's URL and set them on the
tracker.

Create custom dimensions

In addition to the standard campaign dimensions available in Google Analytics
you can define new session scoped custom dimensions to import custom campaign
data. For example, you could create a custom dimension called
Campaign Group. From the Admin page the steps to create a
custom dimension are:

Note: Before uploading data, you should
verify that the data set headers map to the correct dimensions or metrics. In
our example the ga:dimension1 maps to the
Campaign Group dimension as seen in the
data set created above.

Upload campaign data

Once you've created your session scoped custom dimensions and data set, and
prepared your campaign data for upload in a CSV file, you're ready to upload
your campaign data using the
Management API or through the
web
interface.

After the campaign data has been uploaded, validated, and processed, Campaign
Ids will be joined with the uploaded campaign data when a match occurs on
incoming hits sent to Google Analytics from your property.

Analyze and take action

With the component pieces in place it is now possible to analyze your
campaign performance and take action. The existing
acquisition
reports can be used to analyze the standard campaign parameters or apply
a segment using
your imported custom dimensions (or add your custom dimensions as a secondary
dimension). It is also possible to create your own custom report or automate
your analysis by composing your own query using the
Core Reporting API.

Create a custom report

To get a much more customized view of campaign performance you can
create a custom
report. For example it is possible create a customized campaign report
from the reporting page as follows:

In the left hand navigation click
Acquisition -> Campaigns.

Change the report type to be Flat Table.

Click Customize at the top of the report.

In the dimension drill down add the Campaign Group custom
dimension created above.