[UA] Product Data import example

Learn how to import clothing colors and sizes from your product catalog.

Importing product metadata facilitates better merchandising insights by adding product-related dimensions, such as size, color, and style, to your collected Analytics data.

To use this feature, your property must be using the Enhanced Ecommerce plugin.

You'll also need the ability to modify your ecommerce code to send Product SKUs with each of your hits.

In this article:

Scenario:

You are an ecommerce clothing retailer and you want to see which colors and sizes on your site are most popular.

Step One: Tag your site with the ec.js plugin

Following the guidelines in Tag your pages with the ec.js plugin, you tag your product lists, product-detail pages, internal promotions, and your shopping-cart and check-out pages.

Step Two: Decide what data to import

You maintain a data file outside of Analytics that associates each article of clothing with a color and size and you plan to upload this information into Analytics.

Step Three: Create the custom dimension

Since color and size don’t exist as dimensions in Analytics, you’ll need to create them as custom dimensions.

Step Four: 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 Product Data as the Type.
  6. Name the Data Set: “Colors and Sizes”
  7. Select one or more views in which you want to see this data.
  8. Define the Schema using the example below as a model.

Schema Example

While you don’t explicitly send color and size in your hit data, you do send a product ID. To join on the product ID, you would select Product SKU as your Key.

Schema Settings:

Key: Product SKU
Imported Data: Color, Size
Overwrite hit data: Yes

Save the data set.

Step Five: 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 Color and Size to open the data-set configuration.

Click Get schema.

You’ll see something similar to the following:

    CSV header
    ga:productSku,ga:dimension23,ga:dimension24

 

This is the header you should use as the first line of your uploaded CSV files. The table below identifies the columns:

Product SKU Color Size
ga:productSku ga:dimension23 ga:dimension24

2. Create a spreadsheet and export it as a CSV

Create a Google spreadsheet that follows the format above. The first (header) row of your spreadsheet should use the internal dimension names (e.g., ga:productSku instead of Product SKU) provided in the Get schema dialog as shown above. The columns beneath each header cell should include the corresponding data for each header.
 

ga:productSku ga:dimension23 ga:dimension24
12345 Red S
12345 Red M
23456 White M
23456 Blue L

 

Export the spreadsheet as a CSV. Your file will look something like this:

    ga:productSku,ga:dimension23,ga:dimension24
    12345,Red,S
    12345,Red,M
    23456,White,M
    23456,Blue,L

Step Six: 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 Colors and Sizes.
  2. Click Manage uploads for the Colors and Sizes 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 Colors and Sizes.
  2. Click the data-set name.
  3. Click Get Custom Data Source ID…
  4. Make a copy of the ID.
  5. Follow these instructions to upload via the Management API.

Step Seven: Update your Ecommerce code

After you've uploaded product data, update your ecommerce code to send Product SKUs with each of your hits, along with any additional data you want in your reports, like custom dimensions or metrics.

Note: When sending ecommerce data to Analytics, there is no specific field named Product SKU but instead this is represented by the id field as shown in the example below.

// Example of sending a transaction when joining with imported product data.
ga('create', 'UA-XXXX-Y');
ga('require', 'ec', 'ec.js'); // Load the Enhanced Ecommerce plug-in. Required.

// The product name, price, and other product data will be added to this hit
// at collection time if the value of the id field matches a Product SKU
// you've uploaded.
ga('ec:addImpression', {
  'id': '12345',              // Product ID/SKU (Key). Required.
  'list': 'Search Results',
  'position': 1,
  'dimension1': 'Member'
});

ga('send', 'pageview');       // Send the impression with a pageview hit.

 

Product IDs sent from your Enhanced Ecommerce implementation will now be matched to Product SKUs in your imported product Data Set, and your reports will be automatically populated with the the additional product data you've uploaded.

Step Eight: See the data in reports

Since Color and Size are custom dimensions, they do not automatically appear in standard reports, but you can add them as secondary dimensions. For example, in the Product Performance report, you can choose Product SKU as the primary dimension, and then add Color or Size as the secondary dimension.You can also create a custom report with any of the Enhanced Ecommerce metrics (e.g., Product Revenue, Unique Purchases, Quantity), and then add Product SKU, Color, and Size as dimensions.

Uploaded data needs to be processed before it appears in reports. Once processing is complete, it may take up to 24 hours before the imported data is applied to incoming hit data.

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
Google apps
Main menu
2713323150030710668
true
Search Help Center
true
true
true
true
true
69256
false
false