Tracking data

The Segment integration has a number of features that give you fine-grain control over what events are sent to Segment. In this guide, you’ll learn how to use these features to ensure you’re getting the data you need into Segment.

Entries

By default, all entry types generated by your app will be sent to Segment’s Track endpoint.

📘

View our documentation for a full list of entry types.

Entry tracking

Receiving all entry types in Segment can get noisy. Often, there is a subset of entry types that you’ll be interested in sending. In this section we’ll look at a few ways of customizing what entries are sent.

No entry tracking

If you want to stop tracking entries entirely, in your app’s root folder open integrations/segment.yaml and set track_entries to false:

type: meya.segment.integration
write_key: (@ vault.segment.write_key )
track_entries: false

You may want to do use this feature if you’re only interested in tracking changes to user data.

Specific entry tracking

If you want to track specific kinds of entries, you can define an allowlist or denylist for those entry types.

Allowlist

To only send certain entry types to Segment, in your app’s root folder open integrations/segment.yaml and add the tracked_entries property, which is a list of entry types:

type: meya.segment.integration
write_key: (@ vault.segment.write_key )
tracked_entries:
  - meya.text.event.say
  - meya.component.entry.start

In this example, only meya.text.event.say and meya.component.entry.start entries would be sent to Segment.

📘

Note

This setting does not control whether user data is sent.

Denylist

To exclude specific entry types from being sent to Segment, in your app’s root folder open integrations/segment.yaml and add the untracked_entries property, which is a list of entry types:

type: meya.segment.integration
write_key: (@ vault.segment.write_key )
untracked_entries:
  - meya.text.event.say
  - meya.component.entry.start

In this example, every entry type other than meya.text.event.say and meya.component.entry.start would be sent to Segment.

📘

Note

This setting does not control whether user data is sent.

Tracking user data

By default, all updates to the user scope will result in an event being sent to Segment’s Identify endpoint.

Here’s an example of a flow that sets some user scope data:

triggers:
  - keyword: hi

steps:
  - user_set:
      foo: bar
  - say: Hello!

After triggering the flow, you should see a call to Segment’s Identify endpoint in your app logs:

845

In the Segment source’s debugger panel, you can see the message was received:

845

No user data tracking

To stop tracking user data changes entirely, open integrations/segment.yaml and set track_user_data to false:

type: meya.segment.integration
write_key: (@ vault.segment.write_key )
track_user_data: false

Track specific user data

If you want to track specific user data variables, you can define an allowlist or denylist for those variables.

Allowlist

To only send specific user scope variable updates to Segment, open integrations/segment.yaml and add the tracked_user_data property, which is a list of user scope variables:

type: meya.segment.integration
write_key: (@ vault.segment.write_key )
tracked_user_data:
  - count

In this example, only changes to user.count will be sent to Segment.

Denylist

To exclude specific user scope variable updates from being sent to Segment, open integrations/segment.yaml and add the untracked_user_data property, which is a list of user scope variables:

type: meya.segment.integration
write_key: (@ vault.segment.write_key )
untracked_user_data:
  - count

In this example, changes to any user scope variable other than user.count would be sent to Segment.

Filters

You can configure whether or not events should be sent and/or received from Segment, by setting the filter property:

type: meya.segment.integration
write_key: (@ vault.segment.write_key )
filter:
  tx: false

In this example, all tx events have been disabled. This can be used to temporarily turn off the integration without deleting it altogether.

Tracking custom events

Tracking custom events in Segment is easy with the analytics.track component.

Here’s an example:

steps:
  - track: test.event

📘

The track property is the signature field for the analytics.track component.

This very simple flow sends an event called test.event to segment. Here’s what it looks like in Segment:

845

Tracking custom user data

If there is data you don’t want to store on the user scope, but you would like associated with the user in Segment, you can send custom user data to Segment instead using the analytics.identify component.

Here’s an example:

steps:
  - identify:
      foo: bar

📘

The identify property is the signature field for the analytics.identify component.

This creates a property called foo on the Segment user. Here’s what it looks like in Segment:

845