[UA] Refund Data import example [Legacy]

Learn how to import refunds for an example online clothing retailer.
You are viewing a legacy article about Universal Analytics. Learn more about Google Analytics 4 replacing Universal Analytics.

Importing Refund Data lets you align your internal Ecommerce reporting with Analytics.

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

In this article:

Transactions may only be refunded in Analytics within 6 months of the original reported transaction date. Transactions must have been sent in the new Enhanced Ecommerce format. If you are using filters to modify the transaction ID, send the refund with the original unfiltered transaction ID.

You cannot delete or modify refund data once it has been uploaded to your Analytics account. You bear sole responsibility for validating the accuracy of your refund data prior to sending it or uploading it to Analytics.

Scenario:

You are an ecommerce clothing retailer and you want to import refund data so you can analyze the impact to your business with the Analytics Enhanced Ecommerce reports.

Step One: Decide what data to import

You maintain a data file outside of Analytics that associates each clothing product with any refunds issued for that product.

Step Two: Create the Data Set

In order to process refunds you need to have collected transaction data with the ec.js plugin.

  1. Sign in to Google Analytics.
  2. Click Admin, and navigate to the property in which you want to upload data.
  3. In the PROPERTY column, click Data Import.
  4. Click New Data Set.
  5. Select Refund Data as the Type.
  6. Name the Data Set: “Refunds”
  7. Define the Schema using the example below as a model.

Schema Example

Transaction Id is set as the default Key.

Schema Settings:

Key: Transaction Id
Dimension: Product SKU
Metrics: Product Price, Quantity Refunded, Revenue

Save the data set.

Step Three: 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 Refunds to open the data-set configuration.

Click Get schema.

You’ll see something similar to the following:

CSV header
ga:transactionId,ga:productSku,ga:productPrice,ga:quantityRefunded,ga:transactionRevenue

 

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

Transaction Product SKU Price Quantity Refunded Transaction Revenue
ga:transactionId ga:productSku ga:productPrice ga:quantityRefunded ga:transactionRevenue

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:transactionId instead of Transaction) provided in the Get schema dialog as shown above. The columns beneath each header cell should include the corresponding data for each header.

ga:transactionId ga:productSku ga:productPrice ga:quantityRefunded ga:transactionRevenue
T00001 12345 11.99 1 11.99
T00002 23456 11.99 2 23.98
T00003 34567 11.99 3 35.97
T00004 45678 11.99 4 47.96

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

    ga:transactionId,ga:productSku,ga:productPrice,ga:quantityRefunded,ga:transactionRevenue
    T00001,12345,11.99,1,11.99
    T00002,23456,11.99,2,23.98
    T00003,34567,11.99,3,35.97
    T00004,45678,11.99,4,47.96
  

Full vs. Partial refunds

You cannot mix full refunds and partial refunds in the same upload file. Use different upload files for each refund type.

If you want to refund an entire transaction, each row of your upload file should include only the Transaction ID:

ga:transactionId ga:productSku ga:productPrice ga:quantityRefunded ga:transactionRevenue
T00001        

 

If you want to refund a partial transaction, each row of your upload file should include the Transaction ID, Product SKU, and Quantity Refunded:

ga:transactionId ga:productSku ga:productPrice ga:quantityRefunded ga:transactionRevenue
T00001 12345   1  

Step Four: Upload the data

You can 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 Refunds.
  2. Click Manage uploads for the Refunds data set.
    Manage uploads dialog
  3. Click Upload file, select the file, then click Upload.
Upload via the Management API
  1. Sign in to Google Analytics.
  2. Click Admin, and navigate to the property in which you want to upload data.
  3. In the PROPERTY column, click Data Import.
  4. In the list, click the data-set name.
  5. Click Get Custom Data Source ID…
  6. Make a copy of the ID.
  7. Follow these instructions to upload via the Management API.

Step Five: See the data in reports

Once you've uploaded refund data, you can see it in the Sales Performance report.

You can also create a Custom Report with any of the refund metrics (e.g., Local Product Refund Amount, Local Refund Amount, Product Refunds, Product Refund Amount, Quantity Refunded, Refund Amount), and then add any of the available dimensions.

Uploaded data needs to be processed and joined with your existing data. It may take up to 24 hours before the imported data appears in reports.

Was this helpful?

How can we improve it?
Search
Clear search
Close search
Google apps
Main menu