Skip to content

Commit 62b0bff

Browse files
Merge pull request #4332 from segmentio/Tracking-plan-JSON-schema-data-types
Added a note about JSON data types supported by Tracking plans
2 parents c3f65cb + d8ce42f commit 62b0bff

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/protocols/tracking-plan/create.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ The Segment Tracking Plan feature allows you to validate your expected events ag
1515

1616
Tracking Plans are stored in workspaces and can be connected to one or more Sources.
1717

18-
![](./images/tracking-plan.png)
18+
![A screenshot of the Tracking Plans page, showing one tracking plan titled "Ecommerce Spec".](./images/tracking-plan.png)
1919

2020
## Create a Tracking Plan
2121

@@ -70,7 +70,7 @@ You can apply `key:value` labels to each event to help organize your tracking pl
7070

7171
For consistency purposes, it's best that you create a standard way of labeling events and share it with all parts of your organization that will use Segment.
7272

73-
![](./images/labels.png)
73+
![A screenshot of a tracking plan, zoomed in to show the event labels search bar. A label of "platform:ios" is present in the search bar.](./images/labels.png)
7474
> info ""
7575
> **Note:** Tracking Plan Labels are only available for Track and Page events.
7676
@@ -160,6 +160,9 @@ To edit the common JSON schema using the Public API, you'll need to add your new
160160
> info ""
161161
> [Negative lookahead regexes (`?!`)](https://www.regular-expressions.info/lookaround.html) aren't supported. This means you can't use regex to prevent matches with a specific following character or expression. But, you can use `not` in the regex of your JSON schema to generate violations when a property key or value doesn't match the provided regex pattern.
162162
163+
> info "Specifying data type"
164+
> Property or trait data type should adhere to the [data types defined by JSON schema](https://json-schema.org/understanding-json-schema/reference/type.html){:target="_blank”}. Data type names must be lower-cased as specified in JSON schema. Datetime properties should be represented as a `string` type with [`format` keyword](https://json-schema.org/understanding-json-schema/reference/string.html#format){:target="_blank”} (for example: "format": "date-time").
165+
163166
### Extend the Tracking Plan
164167
Some customers prefer to manage the Tracking Plan with outside tools and resources. See the [APIs and extensions](/docs/protocols/apis-and-extensions/) section to learn more.
165168

@@ -176,19 +179,19 @@ This can be helpful for mobile developers who might have several released versio
176179

177180
For example, say you want to add `subtotal` as a required property to your `Order Completed` event. You would start by adding the required property to the event in the Tracking Plan as shown in the example below.
178181

179-
![](../images/breaking_change_event_versioning.png)
182+
![Two screenshots edited together. The first screenshot shows all the properties in an Order Completed event with none highlighted, and the second screenshot shows the subtotal property selected.](../images/breaking_change_event_versioning.png)
180183

181184
Before Segment introduced event versioning, you would need to add the change to your tracking plan and any non-compliant events would generate violations, and possibly be blocked depending on your [event blocking settings](/docs/protocols/enforce/schema-configuration/).
182185

183186
### Create a new event version
184187
With event versioning, you can now create multiple versions of the event definition as shown in the example below. To create a new event version, click into the overflow menu for an event and select **Add Event Version**.
185188

186-
![](../images/add_event_version.png)
189+
![A screenshot of the overflow menu, with the event versioning setting visible.](../images/add_event_version.png)
187190

188191
### Dynamically validate track events against an event version
189192
To ensure the Track events you send to a Segment source validate against the correct event version, you need to instrument your events to include a `context.protocols.event_version` key and version value. The version value must pass as an integer, and should match the number shown in the Tracking Plan version tab. In the example below, the version number would be **2**.
190193

191-
![](../images/pull_event_version.png)
194+
![A zoomed in version of the Order Completed tab, showing Version 1 and Version 2.](../images/pull_event_version.png)
192195

193196
Next, add the event version number to the context object. For [analytics.js](/docs/connections/sources/catalog/libraries/website/javascript) Track calls, you would instrument the event as in the example below. Note how the JSON objects for `context`, `protocols`, and `event_version` are nested.
194197

0 commit comments

Comments
 (0)