How to pass utms with each unstructured event

Hi, guys, I have events like client_lead__created and deal__moved_to_negotation.
I want pass in each event utms (which are mkt_* params in snowplow), but I don’t understand how to do it.

If I wrote schema like this

  "$schema": "",
  "description": "Schema for client lead created",
  "self": {
    "vendor": "com.erodionov",
    "name": "client_lead__created",
    "format": "jsonschema",
    "version": "1-0-0"
  "type": "object",
  "properties": {
    "id": {
      "type": "number"
    "mktMedium": {
      "type": "string"
  "required": ["id", "mktMedium"],
  "additionalProperties": false

And then pass it in snoplow.js like this

sp(`trackUnstructEvent`, {
  schema: "iglu:com.erodionov/client_lead__created/jsonschema/1-0-0",
  data: {
    id: 1,
    mktMedium: "cpc"

will it work? Will mktMedium became mkt_medium and not unstruct_event_com_erodionov_client_lead__created_1.mktMedium?

Yes, I asked the same thing few days ago ( Marketing campaigns and Iglu webhook )

Apparently it is possible using javascript enrichment. But I also created a github ticket if they can implement it anywhere,


1 Like


I am not sure if I understand intention, but @evgenyrodionov wants to add utm data to all the events - not only on the entry page. This in fact makes stuff a bit more complicated, as Snowplow (similarly to most of the analytical engines) is stateless. The only information, that is being stored is session and user id. The “session enterance data” is visible only as long as JS document scope is not cleaned (so till page reload).

@alex: did you consider possibility to store whole session data, like referrer, UTMs and so to make it available for all events within session? I believe this would help many users including myself…

1 Like