How to get Google Analytics 4 (GA4) to include shipping fee in purchases?

My store is now connected to GA4. However, I noticed that the shipping fee is not being included in order data on Google Analytics. How do I get GA4 to record the shipping fee for each order?

3 Likes

Hello @Jihan_Shareef ,

I am Gina from flareAI app helping Shopify merchants get $5Million+ in sales from Google Search, on autopilot. Hope you are having a good day.

To track the shipping fee for each order on Google Analytics 4 (GA4), you can set up a custom event that fires when the order is completed and includes the shipping fee as a custom parameter. Here’s how you can do it.

  1. Set up a custom event trigger
    In your GA4 account, go to “Admin” and select “Data Streams” from the “Property” column. Then, click on the data stream that corresponds to your Shopify store and select “Tagging” from the left-hand menu. Click on “Create Event” and set the trigger to “Page View”. Give your event a name such as “Order Completed”.

  2. Add custom parameters to your event
    Under the “Parameters” section, click on “Add Custom Parameter”. Name your parameter “Shipping Fee” and set its value to the shipping fee of the order. You can retrieve the shipping fee value from the Shopify order object using Shopify’s Liquid code.

  3. Add the event to your order confirmation page
    In your Shopify store, go to “Themes” and select “Edit Code” for the theme you’re using. Find the template that corresponds to your order confirmation page (typically named “order-confirmation.liquid”) and add the GA4 event code with the custom parameters you just created.

Below is an example of the GA4 event code with the custom parameter.

gtag(‘event’, ‘order_completed’, {
‘Shipping Fee’: {{ order.shipping_price | money_without_currency }}
});

This code will fire the “Order Completed” event and include the shipping fee value as the custom parameter “Shipping Fee”.

Once you’ve set up the custom event, you should start seeing the shipping fee data in your GA4 reports. Keep in mind that it may take some time for the data to populate in your reports, so be patient and allow a few days for the data to appear.

Gina

Hi Gina,

I’m experiencing the same issue but couldn’t find the order finalization page in our theme. I asked the developer of our theme (Focus theme) and they said that Shopify controls that page and it cannot be edited. We’re using the Basic plan; is this answer only applicable to Plus users?

Hi Gina,

Do you know if this is for Plus users only? Our theme doesn’t have a thank you page in its theme files and were told by the developer we cannot edit the page.

Thanks,

Ryan

I am having the same issue, With some of my transactions being double counted too, I’m using the recommended integration through the Google Shopping Channel

1 Like

In the basic version you can find this in the checkout settings under “addition fields to add”

Here you can run scripts that load on the thank-you page, even if you do not have access to the theme files (that are only available on plus).