Integration Support

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.

Hi,
Could you kindly guide me on how to create a custom schema? Your expertise would be greatly appreciated.

The tutorial in our documentation might be helpful

1 Like

Hi,

My snowplow tracker is sending events to the Snowplow collector endpoint successfully.
But I don’t see any files in the Azure blob storage.Why?

Default schema is working fine but when I my custom schema it is not storing any data in azure blob.

def track_link_click(tracker, schema, data):
link_click = SelfDescribing(
SelfDescribingJson(schema,data)
)
link_click2 = tracker.track(link_click)

data = {
“endpoint”: request.build_absolute_uri(),
“method”: request.method,
“headers”: dict(request.headers)
}

    schema = "my_custom_schema_blob_url"
    track_link_click(tracker=self.tracker, schema=schema, data=data)

    response = self.get_response(request)
    resp = self.tracker.flush()

My custom schema is this :
{
“$schema”: “my_custom_schema_blob_url”,
“self”: {
“vendor”: “com.relevancestudio”,
“name”: “request-event”,
“format”: “jsonschema”,
“version”: “1-0-0”
},
“type”: “object”,
“properties”: {
“endpoint”: {
“type”: “string”
},
“method”: {
“type”: “string”
},
“headers”: {
“type”: “object”
}
},
“required”: [“endpoint”, “method”, “headers”],
“additionalProperties”: true
}

It might be worth trying this on Snowplow Micro ( GitHub - snowplow-incubator/snowplow-micro: Standalone application to automate testing of trackers ) first.

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:

{
“$schema”: “http://iglucentral.com/schemas/com.snowplowanalytics.self-desc/schema/jsonschema/1-0-0#”,
“self”: {
“vendor”: “com.relevancestudio”,
“name”: “request-event”,
“format”: “jsonschema”,
“version”: “1-0-0”
},
“type”: “object”,
“properties”: {
“endpoint”: {
“type”: “string”
},
“method”: {
“type”: “string”
},
“headers”: {
“type”: “object”
}
},
“required”: [“endpoint”, “method”, “headers”],
“additionalProperties”: true
}

Hi,
I tried above schema, it is not working.I have created a custom schema do i need to publish it on iglu server,if yes then how ?

I am also receiving validation error on custom schema
image (26)

What is your value for schema?

this is the value for my schema https://rssnowplowstorage.blob.core.windows.net/iglu-schemas/schemas/com.relevancestudio/request-event/jsonschema/1-0-0.json

and this is my custom schema
{
“$schema”: “https://rssnowplowstorage.blob.core.windows.net/iglu-schemas/schemas/com.relevancestudio/request-event/jsonschema/1-0-0.json”,
“self”: {
“vendor”: “com.relevancestudio”,
“name”: “request-event”,
“format”: “jsonschema”,
“version”: “1-0-0”
},
“type”: “object”,
“properties”: {
“endpoint”: {
“type”: “string”
},
“method”: {
“type”: “string”
},
“headers”: {
“type”: “object”
}
},
“required”: [“endpoint”, “method”, “headers”],
“additionalProperties”: true
}

You you try the value suggested above? Integration Support - #8 by mike

I tried it didn’t work without pushing schema to iglu server.
Again when I try to publish schema on iglu central I am receiving this error:

-X PUT http://localhost:8080/api/schemas/iglu:com.relevancestudio/request-event/jsonschema/1-0-0 -H “Content-Type: application/json” -H "apikey: “” -d @/home/algo/Desktop/request-event-schema.json
{“message”:“Authentication error: not authorized”}

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 ?