Hi,
I am currently working on a project in Django/Django Rest and would like to implement event tracking at the API level using Snowplow. I am seeking guidance on how to properly integrate Snowplow with my Django application to track events effectively.
I would also like your advice on which event type to use. Given my requirements, should I go with StructuredEvent, PageView, PagePing, ScreenView, or SelfDescribing events? Your recommendation would be greatly appreciated.
I think this is going to depend a lot on your application and what you are trying to achieve but if it’s a Django web based app I’d steer towards things like page views, page pings and self-describing events.
Structured events aren’t deprecated but they are considered an older way of tracking things and screen views tend to be useful for tracking on mobile apps rather than the web.
If you are instrumenting an API in addition, self-describing is likely the best way to go here where you don’t necessarily have direct user interactions in a UI.
Can you also tell me which schema I should use, or should I create a custom schema?
This is the schema and data I am using:
data = {
“endpoint”: request.build_absolute_uri(),
“method”: request.method,
“headers”: dict(request.headers)
}
schema = “http://iglucentral.com/schemas/com.snowplowanalytics.self-desc/schema/jsonschema/1-0-0#”
context = SelfDescribingJson(schema=schema, data=data)
You should be looking to create a custom schema - the com.snowplowanalytics.self-desc schema is a metaschema, so you don’t need to reference this directly - instead reference the vendor / name / format / version of your custom schema.
At an initial glance my guess would be you’ve changed the metaschema for your schema (to my custom_schema_blob_url). This is a fixed value - so you should leave it as default e.g., your schema becomes:
Hi,
Do I need to publish schema on iglu central or not ?
I had uploaded schema in my server but tracker is trying to find schema on iglu sever.
How to make sure my tracker gets schema from iglu server ?
Iglu Central is managed by Snowplow directly so you don’t need to go and push anything here - just your own personal Iglu registry.
As part of your enrichment process you will have a resolver.json file that tells the enrichment process where to look for schemas ( Iglu Resolver | Snowplow Documentation ). Make sure that your Iglu Server is defined in this file and that will ensure enrich can fetch the schema for you.
The tracker itself isn’t aware of where the schemas are hosted - it just needs the URI that you provide as part of the tracking, and then the lookup and resolution itself is the responsibility of the enricher.