Skip to main content

Attribute keys

An attribute key is the identifier that attributes are calculated against.

Signals includes a number of out-of-the-box attribute keys based on commonly used identifiers from the out-of-the-box atomic user-related fields in all Snowplow events.

Import them into your notebook like this:

from snowplow_signals import (
domain_userid,
domain_sessionid,
user_id,
network_userid,
)

Custom attribute keys

You can also define custom attribute keys, which allows you to calculate attributes on any other Snowplow atomic property you want. Atomic properties are those that are defined in the atomic fields of the core Snowplow event, not properties tracked as part of an entity.

For example, an attribute key that groups by app_id can be defined as:

from snowplow_signals import AttributeKey

app_id_attribute_key = AttributeKey(
name="app_id_attribute_key",
description="The id for the app",
key="app_id",
)

Options

The table below lists all available arguments for a custom attribute key:

ArgumentDescriptionTypeRequired?
nameThe name of the attribute keystring
descriptionA description of the attribute keystring
keyThe key used to join this attribute key to an attribute tablestring
ownerThe owner of the attribute key, typically the email of the primary maintainerstring
ttlThe amount of time that attributes for the attribute key will live in the Profiles Storetimedelta

If a key isn't specified, the name will be used.

Here's an extended example using all possible arguments, based on the atomic platform property:

from datetime import timedelta
from snowplow_signals import AttributeKey

platform_attribute_key = AttributeKey(
name="platform_tracking_attribute_key",
description="Attribute key for analyzing user behavior patterns across different platforms (web, mobile, server-side) to understand cross-platform engagement and optimize user experience",
key="platform",
owner="analytics-team@snowplow.com",
ttl=timedelta(days=365),
)

Custom attribute keys are added to attribute groups in the same way as any of the out-of-the-box attribute keys.

On this page

Want to see a custom demo?

Our technical experts are here to help.