Filter out Shopify events in Google Analytics traffic using a data filter

You can exclude incoming Google Analytics data from processing and reporting if the event contains the event parameter shopify_event_name.

This guide uses a three-step process:

  1. Modify events: Add a new event parameter to all incoming events that already have the shopify_event_name parameter. This example uses the traffic_type param and sets, traffic_type = shopify_event. Data filters in Google Analytics require a traffic_type param, rather than using any param, which is why we are adding it.
  2. Create a data filter: Create a data filter to exclude all data where the traffic_type parameter equals shopify_event.
  3. Check if the filter works: Use Explorations to verify that the filter is working correctly before activating it.

Step 1: Create an event modification rule

This rule will add a new parameter to flag the events you want to filter later.

  1. Open Google Analytics and go to Admin.
  2. Under "Property settings", click Data display > Events.
  3. Click the Custom configuration button and select Modifications.
  4. Click Create.
  5. Enter a descriptive modification name. For example, "Add traffic_type for Shopify events".
  6. In the "Matching conditions" section, configure the following:
    • Parameter: shopify_event_name
    • Operator: matches regular expression with value ".". This will match any value for the parameter.
  7. In the "Modify parameters" section, add the following:
    • Parameter: traffic_type
    • New Value: shopify_event
  8. Click Create.

Result: Any event collected that includes the shopify_event_name parameter will now also have an additional parameter traffic_type with the value shopify_event. This change applies to ALL events going forward until the modification is removed.

Step 2: Create a data filter to exclude the flagged traffic

This is the step where you'll use the newly added parameter to exclude data permanently.

  1. Open Google Analytics and go to Admin.
  2. Under "Property settings", click Data collection and modification > Data filters.
  3. Click Create filter.
  4. Under "Choose filter type", select Internal traffic.
  5. Enter a name for the data filter. The name must:
    • be unique among data filters in the same property
    • begin with a letter or character from any language (full unicode support)
    • contain only unicode letters and numbers, underscores, and spaces
    • contain up to 40 characters
  6. Choose Exclude to filter out events.
  7. In the "Filter events with the following parameter value" section, set the "Parameter value" to shopify_event or whatever name you used in the previous step.
  8. IMPORTANT: It is recommended to set the "Filter state" to Testing first, to verify that you are capturing the intended events. This will apply the filter and tag the events, but won't actually exclude them.
  9. Click Create.

Step 3: Verify that the filter works

Testing a data filter ensures that it's successfully filtering out traffic.

  1. Open Google Analytics and go to Admin.
  2. Choose Free form exploration to build a free-form exploration with these settings:

    • Technique: Free form
    • Rows: Test data filter name
    • Filter: "Test data filter name contains (the name of your data filter)"
  3. Verify that you are seeing the appropriate events captured by the filter. These are the events that will be excluded when you set it to Active.

  4. After verifying that these are correctly filtered using Explorations, set the "Filter state" to Active in Data settings > Data filters to exclude these.