Importing advertising campaign-related dimensions, such as Source and Medium, allows you to expand and reuse your existing non-Google campaign codes.In this article:
You want to import the Medium and Source for each campaign ID that you use in your URLs. For example, you run email campaigns that contain links tagged with
utm_id. You want traffic from these links to be identified with the proper Medium and Source in your reports.
Step One: Decide what data to import
Each of your campaign links includes a
utm_id parameter (e.g.,
http://www.example.com/landingpage?utm_id=123xyz). You maintain a data file outside of Analytics that associates each
utm_id with a Medium and a Source and you plan to upload this information into Analytics. Once this information has been uploaded, Analytics will retrieve the Campaign ID from a URL's
utm_id parameter, and then join the hit data with the Medium and Source that are associated with that particular Campaign ID. If, for example, you upload a data file that associates the Campaign ID "xyz" with a Source of "Spring Newsletter" and a Medium of "Email", all the sessions with
?utm_id=xyz will have a Source of "Spring Newsletter" and a Medium of "Email".
Step Two: Create any needed custom dimensions or metrics
Both Medium and Source are already valid dimensions in Analytics, so no custom dimensions are needed.
Step Three: Create the Data Set
- Sign in to Google Analytics.
- Click Admin, and navigate to the property to which you want to upload data.
- In the PROPERTY column, click Data Import.
- Click New Data Set.
- Select Campaign Data as the Type.
- Name the Data Set:
Campaign ID Details
- Select one or more views in which you want to see this data.
- Define the Schema:
Key: Campaign Code
Imported Data: Source, Medium
Overwrite hit data: Yes
Step Four: Create the CSV
Generating your upload CSV file is a 2-step process:
1. Get the header for the CSV
In the Data Set table, click "Campaign ID Details" in the table to be taken back to the Data Set schema screen.
Click Get schema. You'll see something similar to the following:
CSV header ga:campaignCode,ga:source,ga:medium
This is the header you should use as the first line of your uploaded CSV files. The table below identifies the columns:
2. Create a spreadsheet and export it as a CSV
Close the dialog and create a Google spreadsheet that follows the format. The first (header) row of your spreadsheet should use the internal names (e.g.
ga:campaignCode) provided in the Get schema dialog as shown above. The columns beneath each header cell should include the corresponding data for each header.
Export the spreadsheet as a CSV. Your file will look something like this:
Step Five: Upload the data
You can must now upload the CSV file you created to Analytics. You have two choices for uploading your data: manually, using the Analytics user interface, or programmatically, using the Management API.Upload manually
In the Data Set table, find the row for the
Campaign ID DetailsData Set.
- Click Manage uploads for that Data Set.
- Click Upload file, select the CSV file you created, then click Upload.
- In the Data Set table, find the row for
Campaign ID Details.
- Click the data-set name.
- Click Get Custom Data Source ID
- Make a copy of the ID.
- Follow these instructions to upload via the Management API.
Once this information has been uploaded, Analytics will retrieve the Campaign ID from a URL's
utm_id parameter, and then join the hit data with the Medium and Source that are associated with that particular Campaign ID. For example, if you upload the data file shown above, all the sessions with
?utm_id=567abc will have a Source of "Spring Newsletter" and a Medium of "email".
Step Six: See the data in reports
To see the data, go to the Acquisition > All Traffic or Acquisition > Channels report. Select Source, Medium, or Source/Medium as the Primary Dimension.
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.