Importing user metadata, such as a loyalty rating or lifetime customer value, enables you to create highly relevant Segments and Remarketing Audience lists.
Scenario
You want to understand which features on your site are most popular with food and wine enthusiasts, sports enthusiasts, and other customer segments. You maintain a data file outside of Analytics that associates customer IDs with customer segments and you plan to upload this information into Analytics to use as the basis for a Remarketing Audience.
Step One: Decide what data to import
The user IDs that you upload need to match the user IDs that you set in the hits received by your site. Refer to the developer documentation to learn how to set user ID in hits.
Step Two: Create the Custom Dimension
Since Customer Segment doesn’t exist as a dimension in Analytics, you’ll need to create it as a Custom Dimension.
Custom Dimension Name | Scope |
---|---|
Customer Segment | User |
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 User Data as the Type.
- Name the Data Set: Customer metadata
- Select one or more views in which you want to see this data.
- Define the Schema:
Key: Visitor > User ID
Imported Data: Custom Dimensions > Customer Segment
Overwrite hit data: Yes
Click Save.
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 Customer metadata. This will display the Data Set schema page.
Click Get schema. You’ll see something similar to the following:
CSV header ga:userId,ga:dimension16
This is the header you should use as the first line of your uploaded CSV files. The table below identifies the columns:
User ID | Customer Segment |
---|---|
ga:userId | ga:dimension16 |
2. Create a spreadsheet and export it as a CSV
Create a spreadsheet that follows the format above. The first (header) row of your spreadsheet should use the internal names (e.g. ga:pagePath
instead of Page) provided in the Get schema dialog as shown above. The columns beneath each header cell should include the corresponding data for each header.
ga:userId | ga:dimension16 |
---|---|
456abc | Food/Wine Enthusiasts |
383ghz | Food/Wine Enthusiasts |
323hht | Motorsports Enthusiasts |
541vvv | Motorsports Enthusiasts |
Export the spreadsheet as a CSV. Your file will look something like this:
ga:UserId,ga:dimension16
456abc,Food/Wine Enthusiasts
383ghz,Food/Wine Enthusiasts
323hht,Motorsports Enthusiasts
541vvv,Motorsports Enthusiasts
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.
Step Six: Analyze and take action
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.
With the component pieces in place it is now possible to analyze the results and take action. For example, to create a Remarketing Audience, complete each of the steps below:
- Create a custom report
- Create a segment
- Create a remarketing audience
Next steps
Once you've created a Remarketing Audience, you should create a new Google Ads campaign and add your Audience to an ad group. See the Google Ads Remarketing Help Center article for details.