Setting up events with the right context


my use case is the following:

  1. I have paid content articles on a website
  2. I have a shop where subscriptions can be bought
  3. I want to know which articles were the last before a subscription

I’m wondering what is the best way to build the logic in tracking.

I do have a custom context that is describing articles further - sent with each article page view.

My options would be:

  1. If I send a conversion event when someone buys a subscription, I could attach the same article custom context to it.
  2. Self Describing event using the same context as schema
  3. Self Describing event using the same article context as context
  4. Building a new schema with the same fields as the article context as “conversion context”

What would you recommend?


Hi @volderette
Due to the flexibility of Snowplow, any of the options you mention would technically work although the final decision often comes down to how you intend to use this data when it comes to modelling and creating analytical views from it.

Personally, I like to keep the concept of “Event Schemas” and “Entity Schemas” quite seperate, so I wouldn’t want to use the “Article” schema as a Self Describing event. In a data modelling sense, it doesn’t make much sense to have an event called “Article”, an event is usually created by a user action. I feel like the event name should be reflective of the action the user has taken (for example “ArticleView” or “SubscriptionPurchase”).
An “Article” schema is a great example of an entity schema however, where you would attach this entity to your events to give them additional context.

In your example, my initial reaction is I would create two schemas:

  1. Article
  2. Subscription Purchase

I would then send a “Subscription Purchase” self describing event with the “Article” context attached. I’d then understand in my data modelling steps that the “Article” context attached to any “Subscription Purchase” event is the last article that a user viewed before purchasing a subscription.

With the JavaScript Tracker, this might look something like (replacing the schemas here with your own):

window.snowplow('trackSelfDescribingEvent', {
    schema: 'iglu:com.acme/subscription_purchase/jsonschema/1-0-0',
    data: {
        id: 'SUB1010245',
        name: 'My First Subscription',
        purchasedAt: new Date()
},  [{
    schema: "iglu:com.acme/article/jsonschema/1-0-0",
    data: {
        id: 'ART138484',
        title: 'The Article',
        viewedAt: new Date(2020, 03, 18, 14, 05, 12)
1 Like

Thank you @PaulBoocock, this was very helpful!

1 Like