[UA] User Data import example

Learn how to import a Customer Segment dimension to track your users' interests.

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.

You can use (i.e. upload and use in hits) the same user IDs that you maintain in your offline data source as long as these IDs do not contain any personally identifying information. Note that the Analytics Terms of Service, which all Analytics customers must adhere to, prohibits sending personally identifiable information (PII) to Analytics, such as names, social security numbers, email addresses, or any similar data.

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

  1. Sign in to Google Analytics.
  2. Click Admin, and navigate to the property to which you want to upload data.
  3. In the PROPERTY column, click Data Import.
  4. Click New Data Set.
  5. Select User Data as the Type.
  6. Name the Data Set: Customer metadata
  7. Select one or more views in which you want to see this data.
  8. 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
  1. In the Data Set table, find the row for Customer metadata.
  2. Click Manage uploads for Data Set.
  3. Click Upload file, select the file, then click Upload.
Upload via the Management API
  1. In the Data Set table, find the row for Customer metadata.
  2. Click the Data Set name.
  3. Click Get Custom Data Source ID.
  4. Copy the ID to the clipboard (e.g. CTRL-C).
  5. 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:

  1. Create a custom report
  2. Create a segment
  3. Create a remarketing audience
Create a custom report

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).

  1. Click + New Custom Report.
  2. Change the report type to be Flat Table.
  3. Select the Customer Segment custom dimension you created above.
  4. Select Sessions or any other metric you would like to use to measure a user groups behavior.
Create a Segment

Create a segment representing the users you want to target. From the custom report perform the following steps:

  1. Click Add Segment.
  2. Click New Segment.
  3. Click Advanced Conditions.
  4. Change filter from Sessions to Users.
  5. Select the Customer Segment custom dimension you created above.
  6. Add as many conditional groups to the segment as you would like and click Save.
  7. Iterate with the segments conditions and view the results in the custom report until you are satisfied with the segment.
Create a Remarketing Audience

After your create a segment, you can use it as the basis for a Remarketing Audience:

  1. Follow the instructions to create a remarketing audience. When you reach the Define your audience step, click Import Segment.
  2. 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.

Was this helpful?

How can we improve it?
true
Choose your own learning path

Check out google.com/analytics/learn, a new resource to help you get the most out of Google Analytics 4. The new website includes videos, articles, and guided flows, and provides links to the Google Analytics Discord, Blog, YouTube channel, and GitHub repository.

Start learning today!

Search
Clear search
Close search
Main menu
3167786411683806186
true
Search Help Center
true
true
true
true
true
69256
false
false