Importing user metadata, such as a loyalty rating or lifetime customer value, enables you to create highly relevant Segments and Remarketing Audience lists.
In this article: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.
Upload manually- In the Data Set table, find the row for Customer metadata.
- Click Manage uploads for Data Set.
- Click Upload file, select the file, then click Upload.
- In the Data Set table, find the row for Customer metadata.
- Click the Data Set name.
- Click Get Custom Data Source ID.
- Copy the ID to the clipboard (e.g. CTRL-C).
- Follow these instructions to upload via 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
Since Customer Segment is a custom dimension, it does not appear in standard reports. To see the total number of pageviews by Customer Segment, for example, you would create a Custom Report with one metric (Pageviews) and one dimension (Customer Segment).
- Click + New Custom Report.
- Change the report type to be Flat Table.
- Select the Customer Segment custom dimension you created above.
- Select Sessions or any other metric you would like to use to measure a user groups behavior.
Create a segment representing the users you want to target. From the custom report perform the following steps:
- Click Add Segment.
- Click New Segment.
- Click Advanced Conditions.
- Change filter from Sessions to Users.
- Select the Customer Segment custom dimension you created above.
- Add as many conditional groups to the segment as you would like and click Save.
- Iterate with the segments conditions and view the results in the custom report until you are satisfied with the segment.
After your create a segment, you can use it as the basis for a Remarketing Audience:
- Follow the instructions to create a remarketing audience. When you reach the Define your audience step, click Import Segment.
- Select the segment you created above.
Notes:
- Data imported via processing time data import is not available to a Remarketing list until the user returns to your site after the data is uploaded.
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.