1

E-commerce event tracking

This guide will help introduce the important events to track for your e-commerce site or app. E-commerce companies have specific needs for analytics tracking to get the most out of the tools they use. For example, it’s important to have the concept of “orders” with individual “products” in them.

If you're just looking for the technical guide and code examples needed to utilize Segment's e-commerce semantic events, check out our e-commerce spec docs.

How Does e-commerce Tracking Work?

One of the core components of the Segment Spec is the track method. It records any arbitrary event that the user has triggered. For e-commerce tracking, you will be sending specific event names that we recognize semantically. That way we can transform them before sending them off to each different tool.

Below are examples for tracking the most important actions in e-commerce. We’ll walk you through which events to track, from the very first time a product is viewed to when an order is completed…

Viewing a Product Category

Category pages are a staple of e-commerce. They let the user browse all of the products in a specific category. You’ll want to track all of your product category pages so you can quickly see which categories are most popular.

To do that, you’ll want to record a specially recognized event called Viewed Product Category using a track call.

Viewing a Product

The second special event to record for an e-commerce installation is 'Viewed Product'. To record that you’ll use a track call.

You can learn more about our track method here.

Note that the properties are required to tell individual tools like Google Analytics about the specific product that was viewed. You can always add your own custom properties as well.

Adding to Cart

Next up are two events that are critical to figuring out how your customers are interacting with your products: 'Added Product' and 'Removed Product'. The former is for when products are added to the customer’s shopping cart and the latter, for when they are removed.

The properties to record for each of these are the same as the ones for the'Viewed Product' event above (of course you can always add more properties of your own too!).

Completing an Order

The final step is to record a 'Completed Order' event when people complete your checkout process. It’s the most important event to record, since you’ll use it for A/B tests, sales dashboards, conversion pixels and pretty much everything you can think of!

Be sure to include all items in the cart as event properties, with the same properties from the previous calls.

You can learn more about examples of specific events in our Spec here

That’s it! You’ve finished setting up a basic e-commerce setup with Segment and you’re now sending your e-commerce-specific data off to any integration you enable.