# Page element visibility and interaction tracking
> Track page element visibility, button clicks, and form interactions to understand how users engage with specific components on your web pages.
> Source: https://docs.snowplow.io/docs/events/ootb-data/page-elements/
> Documentation index: https://docs.snowplow.io/llms.txt

Page element tracking captures user interactions with specific elements on your web pages, including buttons, forms, and any other visible components.

Use page element tracking to:

- Measure button click engagement across your site
- Track form interactions including focus, changes, and submissions
- Understand which page sections users actually see
- Build funnel analysis based on element visibility and interactions
- Measure content consumption and scroll depth

## Button clicks

Button click tracking automatically captures clicks on `<button>` and `<input type="button">` elements.

This table shows the support for button click tracking across the main client-side [Snowplow tracker SDKs](/docs/sources/):

| Tracker                                                                   | Supported | Since version | Auto-tracking | Notes                               |
| ------------------------------------------------------------------------- | --------- | ------------- | ------------- | ----------------------------------- |
| [Web](/docs/sources/web-trackers/tracking-events/button-click/)           | ✅         | 3.18.0        | ✅             | Requires button click plugin        |
| iOS                                                                       | ❌         |               |               |                                     |
| Android                                                                   | ❌         |               |               |                                     |
| React Native                                                              | ❌         |               |               |                                     |
| Flutter                                                                   | ❌         |               |               |                                     |
| Roku                                                                      | ❌         |               |               |                                     |
| [Google Tag Manager](/docs/sources/google-tag-manager/snowplow-template/) | ✅         | v4            | ✅             | Integrates with button click plugin |

We recommend using the [Base web tracking plan template](/docs/event-studio/tracking-plans/templates/#base-web) for web tracking. It includes button clicks.

### `button_click`

**Type:** Event

Schema for a button click event

**Properties:**

| Property          | Description                                                     |
| ----------------- | --------------------------------------------------------------- |
| `label` _string_  | _Required._ The text on the button, or a user-provided override |
| `id` _string_     | _Optional._ The ID of the button                                |
| `classes` _array_ | _Optional._ The classes of the button                           |
| `name` _string_   | _Optional._ The name attribute of the button                    |

**Example warehouse query (Snowflake):**

```sql
select
unstruct_event_com_snowplowanalytics_snowplow_button_click_1 button_click_1
from
atomic.events
where
events.collector_tstamp > getdate() - interval '1 hour'
and events.event = 'unstruct'
and events.event_name = 'button_click'
and events.event_vendor = 'com.snowplowanalytics.snowplow'
```

## Form interactions

Form tracking captures three types of events: when a user focuses on a form field, when a field value changes, and when a form is submitted.

This table shows the support for form tracking across the main client-side [Snowplow tracker SDKs](/docs/sources/):

| Tracker                                                                   | Supported | Since version                       | Auto-tracking | Notes                                                                                             |
| ------------------------------------------------------------------------- | --------- | ----------------------------------- | ------------- | ------------------------------------------------------------------------------------------------- |
| [Web](/docs/sources/web-trackers/tracking-events/form-tracking/)          | ✅         | 2.1.0 (directly), 3.0.0 (as plugin) | ✅             | Requires form tracking plugin                                                                     |
| iOS                                                                       | ❌         |                                     |               |                                                                                                   |
| Android                                                                   | ❌         |                                     |               |                                                                                                   |
| React Native                                                              | ❌         |                                     |               |                                                                                                   |
| Flutter                                                                   | ❌         |                                     |               |                                                                                                   |
| Roku                                                                      | ❌         |                                     |               |                                                                                                   |
| Python                                                                    | ❌         |                                     |               | The Python tracker has deprecated form tracking APIs; use custom events with form schemas instead |
| [Google Tag Manager](/docs/sources/google-tag-manager/snowplow-template/) | ✅         | v3                                  | ✅             | Integrates with form tracking plugin                                                              |

### Focus form event

Triggered when a user focuses on a form field.

### `focus_form`

**Type:** Event

Schema for a form field focus event

**Properties:**

| Property                 | Description                                                                            |
| ------------------------ | -------------------------------------------------------------------------------------- |
| `formId` _string_        | _Required._ The ID of the form                                                         |
| `elementId` _string_     | _Optional._ The ID of the element                                                      |
| `nodeName` _string_      | _Required._ The node name of the element Must be one of: `INPUT`, `TEXTAREA`, `SELECT` |
| `elementType` _string_   | _Optional._ The type of the element                                                    |
| `elementClasses` _array_ | _Required._ The classes of the element                                                 |
| `value` _string_         | _Optional._ The value of the element                                                   |

**Example warehouse query (Snowflake):**

```sql
select
unstruct_event_com_snowplowanalytics_snowplow_focus_form_1 focus_form_1
from
atomic.events
where
events.collector_tstamp > getdate() - interval '1 hour'
and events.event = 'unstruct'
and events.event_name = 'focus_form'
and events.event_vendor = 'com.snowplowanalytics.snowplow'
```

### Change form event

Triggered when a user changes the value of a form field.

### `change_form`

**Type:** Event

Schema for a form field change event

**Properties:**

| Property                 | Description                                                                            |
| ------------------------ | -------------------------------------------------------------------------------------- |
| `formId` _string_        | _Required._ The ID of the form                                                         |
| `elementId` _string_     | _Optional._ The ID of the element                                                      |
| `nodeName` _string_      | _Required._ The node name of the element Must be one of: `INPUT`, `TEXTAREA`, `SELECT` |
| `elementType` _string_   | _Optional._ The type of the element                                                    |
| `elementClasses` _array_ | _Required._ The classes of the element                                                 |
| `value` _string_         | _Required._ The value of the element                                                   |

**Example warehouse query (Snowflake):**

```sql
select
unstruct_event_com_snowplowanalytics_snowplow_change_form_1 change_form_1
from
atomic.events
where
events.collector_tstamp > getdate() - interval '1 hour'
and events.event = 'unstruct'
and events.event_name = 'change_form'
and events.event_vendor = 'com.snowplowanalytics.snowplow'
```

### Submit form event

Triggered when a user submits a form. Contains data about all form fields.

### `submit_form`

**Type:** Event

Schema for a form submission event

**Properties:**

| Property              | Description                                    |
| --------------------- | ---------------------------------------------- |
| `formId` _string_     | _Required._ The ID of the form                 |
| `formClasses` _array_ | _Required._ The classes of the form            |
| `elements` _array_    | _Required._ The form elements and their values |

**Example warehouse query (Snowflake):**

```sql
select
unstruct_event_com_snowplowanalytics_snowplow_submit_form_1 submit_form_1
from
atomic.events
where
events.collector_tstamp > getdate() - interval '1 hour'
and events.event = 'unstruct'
and events.event_name = 'submit_form'
and events.event_vendor = 'com.snowplowanalytics.snowplow'
```

## Page element visibility and lifecycle

Element visibility tracking enables declarative tracking of page elements as they are created, become visible, leave view, or are removed from the page. It's only available for web.

This table shows the support for page element visibility tracking across the main client-side [Snowplow tracker SDKs](/docs/sources/):

| Tracker                                                             | Supported | Since version | Auto-tracking |
| ------------------------------------------------------------------- | --------- | ------------- | ------------- |
| [Web](/docs/sources/web-trackers/tracking-events/element-tracking/) | ✅         | 4.6.0         | ✅             |
| iOS                                                                 | ❌         |               |               |
| Android                                                             | ❌         |               |               |
| React Native                                                        | ❌         |               |               |
| Flutter                                                             | ❌         |               |               |
| Roku                                                                | ❌         |               |               |
| Google Tag Manager                                                  | ❌         |               |               |

### Events

The element tracking plugin generates four event types:

- `create_element`: when a matching element is added to the page
- `expose_element`: when a matching element scrolls into view
- `obscure_element`: when a matching element scrolls out of view
- `destroy_element`: when a matching element is removed from the page

All of these events have a single property, `element_name`. The plugin adds an `element` entity with information about the tracked element.

You can also configure the tracker to attach `element_statistics`, `element_content`, or `component_parents` entities.

#### Create element event

Triggered when an element matching a named configuration is added to the page or detected on page load.

### `create_element`

**Type:** Event

Event that fires when an element matching a named configuration is detected as existing in or being added to a document.

**Properties:**

| Property                | Description                                                                                                                                  |
| ----------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
| `element_name` _string_ | _Required._ The name of the element that was created. Should match the element name field in entities that describe this particular element. |

**Example warehouse query (Snowflake):**

```sql
select
unstruct_event_com_snowplowanalytics_snowplow_create_element_1 create_element_1
from
atomic.events
where
events.collector_tstamp > getdate() - interval '1 hour'
and events.event = 'unstruct'
and events.event_name = 'create_element'
and events.event_vendor = 'com.snowplowanalytics.snowplow'
```

#### Expose element event

Triggered when a tracked element scrolls into the viewport and becomes visible to the user.

### `expose_element`

**Type:** Event

Event that fires when an element matching a named configuration is detected as intersecting with the viewport, becoming visible to the user.

**Properties:**

| Property                | Description                                                                                                                                  |
| ----------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
| `element_name` _string_ | _Required._ The name of the element that was exposed. Should match the element name field in entities that describe this particular element. |

**Example warehouse query (Snowflake):**

```sql
select
unstruct_event_com_snowplowanalytics_snowplow_expose_element_1 expose_element_1
from
atomic.events
where
events.collector_tstamp > getdate() - interval '1 hour'
and events.event = 'unstruct'
and events.event_name = 'expose_element'
and events.event_vendor = 'com.snowplowanalytics.snowplow'
```

#### Obscure element event

Triggered when a tracked element scrolls out of the viewport or becomes hidden from the user.

### `obscure_element`

**Type:** Event

Event that fires when an element matching a named configuration is detected as becoming hidden from a user or moving out of the viewport.

**Properties:**

| Property                | Description                                                                                                                                   |
| ----------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
| `element_name` _string_ | _Required._ The name of the element that was obscured. Should match the element name field in entities that describe this particular element. |

**Example warehouse query (Snowflake):**

```sql
select
unstruct_event_com_snowplowanalytics_snowplow_obscure_element_1 obscure_element_1
from
atomic.events
where
events.collector_tstamp > getdate() - interval '1 hour'
and events.event = 'unstruct'
and events.event_name = 'obscure_element'
and events.event_vendor = 'com.snowplowanalytics.snowplow'
```

#### Destroy element event

Triggered when a tracked element is removed from the page.

### `destroy_element`

**Type:** Event

Event that fires when an element matching a named configuration is detected as being removed from a document.

**Properties:**

| Property                | Description                                                                                                                                    |
| ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| `element_name` _string_ | _Required._ The name of the element that was destroyed. Should match the element name field in entities that describe this particular element. |

**Example warehouse query (Snowflake):**

```sql
select
unstruct_event_com_snowplowanalytics_snowplow_destroy_element_1 destroy_element_1
from
atomic.events
where
events.collector_tstamp > getdate() - interval '1 hour'
and events.event = 'unstruct'
and events.event_name = 'destroy_element'
and events.event_vendor = 'com.snowplowanalytics.snowplow'
```

### Element entity

The `element` entity is attached to all element tracking events and contains information about the tracked element's position, dimensions, and attributes.

### `element`

**Type:** Schema

Schema for element context

**Properties:**

| Property                         | Description                                                       |
| -------------------------------- | ----------------------------------------------------------------- |
| `element_name` _string_          | _Required._ The name of the element                               |
| `width` _number_                 | _Optional._ The width of the element                              |
| `height` _number_                | _Optional._ The height of the element                             |
| `position_x` _number_            | _Optional._ The x position of the element in the viewport         |
| `position_y` _number_            | _Optional._ The y position of the element in the viewport         |
| `doc_position_x` _number_        | _Optional._ The x position of the element in the document         |
| `doc_position_y` _number_        | _Optional._ The y position of the element in the document         |
| `element_index` _integer_        | _Optional._ The index of this element among all matching elements |
| `element_matches` _integer_      | _Optional._ The total number of elements matching the rule        |
| `originating_page_view` _string_ | _Optional._ The page view ID when the element was first observed  |
| `attributes` _array_             | _Optional._ Custom attributes extracted from the element          |

### Element statistics entity

The `element_statistics` entity contains information about element visibility and scroll depth.

### `element_statistics`

**Type:** Schema

Schema for element statistics

**Properties:**

| Property                          | Description |
| --------------------------------- | ----------- |
| `element_name` _string_           | _Required._ |
| `element_index` _integer_         | _Optional._ |
| `element_matches` _integer_       | _Optional._ |
| `current_state` _string_          | _Optional._ |
| `min_size` _string_               | _Optional._ |
| `current_size` _string_           | _Optional._ |
| `max_size` _string_               | _Optional._ |
| `y_depth_ratio` _number_          | _Optional._ |
| `max_y_depth_ratio` _number_      | _Optional._ |
| `max_y_depth` _string_            | _Optional._ |
| `element_age_ms` _integer_        | _Optional._ |
| `times_in_view` _integer_         | _Optional._ |
| `total_time_visible_ms` _integer_ | _Optional._ |

### Element content entity

The `element_content` entity captures data extracted from a tracked element, including its position within a parent component hierarchy.

### `element_content`

**Type:** Schema

Entity describing the content of an element matching a named configuration.

**Properties:**

| Property                  | Description                                                                                                                                                                               |
| ------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `parent_name` _string_    | _Required._ The name of the configuration for the element/component that contains the element described by this entity.                                                                   |
| `parent_index` _integer_  | _Required._ The index of this element's parent element/component's within it's parent's other matches for it's element configuration.                                                     |
| `element_name` _string_   | _Required._ The name of the configuration for the element/component that contains this data. This will usually match the corresponding element\_name in an event payload or other entity. |
| `element_index` _integer_ | _Required._ The position of this element's within it's parent's other matches for the element's configuration.                                                                            |
| `attributes` _array_      | _Optional._ Results of configured contents descriptions found on this element.                                                                                                            |

### Component parents entity

The `component_parents` entity records the hierarchy of parent components that contain a tracked element.

### `component_parents`

**Type:** Schema

Entity describing the list of components that were found to contain the element with the named configuration.

**Properties:**

| Property                 | Description                                                                                                                                                                      |
| ------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `element_name` _string_  | _Optional._ Name of the element that this entity relates to, if any. If not provided, may apply to a subject of some other event, such as Link, Button, or Form Tracking events. |
| `component_list` _array_ | _Required._ List of component names that were detected as containing the element that is the subject of this event.                                                              |
