---
title: ValidStandardEventData
description: Identifies invalid arguments to the standard_event_data filter.
source_url:
  html: >-
    https://shopify.dev/docs/storefronts/themes/tools/theme-check/checks/valid-standard-event-data
  md: >-
    https://shopify.dev/docs/storefronts/themes/tools/theme-check/checks/valid-standard-event-data.md
api_name: liquid
---

# ValidStandardEventData

Identifies invalid arguments to the [`standard_event_data`](https://shopify.dev/docs/api/liquid/filters/standard_event_data) filter. The only supported event type is `'view'`. The optional `context` argument accepts only the values that the filter's input supports:

| Input | Valid `context` values |
| - | - |
| `product` | `page`, `search`, `collection`, `dialog`, and `recommendation` |
| `cart` | `page` and `dialog` |
| `collection` | Not checked, because the filter ignores `context` for collections. |

Theme Check identifies the input when the filter is applied directly to the `product`, `cart`, or `collection` variable. For any other input, such as `line_item.product`, or when another filter comes first, Theme Check accepts a `context` value that's valid for a product or a cart.

Theme Check doesn't check an event type or a `context` value that's a variable, such as `section.settings.context`. It reports a literal value that isn't a string, such as `123` or `true`.

***

## Examples

The following examples contain code snippets that either fail or pass this check.

### ✗ Fail

In the following example, `homepage` isn't a valid context for a product, so Theme Check reports `Unsupported context 'homepage' for product. Valid values: page, search, collection, dialog, recommendation. The 'context' argument can also be omitted.`:

```liquid
{{ product | standard_event_data: 'view', context: 'homepage' }}
```

In the following example, `recommendation` is valid for a product but not for a cart, so Theme Check reports `Unsupported context 'recommendation' for cart. Valid values: page, dialog. The 'context' argument can also be omitted.`:

```liquid
{{ cart | standard_event_data: 'view', context: 'recommendation' }}
```

In the following example, `click` isn't a supported event type, so Theme Check reports `Unsupported event type 'click'. The only supported event type is 'view'.`:

```liquid
{{ product | standard_event_data: 'click', context: 'page' }}
```

### ✓ Pass

In the following example, each filter uses the `view` event type and a context that its input supports, or no context:

```liquid
{{ product | standard_event_data: 'view', context: 'recommendation' }}
{{ cart | standard_event_data: 'view', context: 'dialog' }}
{{ collection | standard_event_data: 'view' }}
```

***

## Options

The following example contains the default configuration for this check:

```yaml
ValidStandardEventData:
  enabled: true
  severity: error
```

| Parameter | Description |
| - | - |
| `enabled` | Whether this check is enabled. |
| `severity` | The [severity](https://shopify.dev/docs/storefronts/themes/tools/theme-check/configuration#check-severity) of the check. |

***

## Disabling this check

Disabling this check isn't recommended. If you can't avoid violating the rule, then you should disable the check using the [comment syntax](https://shopify.dev/docs/storefronts/themes/tools/theme-check/configuration#disable-checks-using-liquid-comments). This ensures that you intentionally disable the check for each instance.

```liquid
{% # theme-check-disable ValidStandardEventData %}
{{ product | standard_event_data: 'view', context: 'homepage' }}
{% # theme-check-enable ValidStandardEventData %}
```

***
