Self-Describing JSON for google analytics tags


#1

Where can we get response JSON structure for transaction and Transaction item tags? We know snowplow has some tags modeled on google analytics enhanced e-commerce but where are these tags self-describing JSON schema hosted. I am unable to locate it.


#2

@Dev, it’s on Iglu Central: https://github.com/snowplow/iglu-central/tree/master/schemas/com.google.analytics.ecommerce


#3

Thanks, ihor.
So, in this case does snowplow using google analytics ecomerce tag as it is or modifying existing tag? and if they are modifying, then can we also modify snowplow’s existing tags like add_to_cart by sending any extra fields to it?


#4

@Dev, no, you cannot extend it as the data loads to events table (ti_... and tr_... columns), which has a predefined size. However, you could extend them with custom context, which will be loaded into a separate (dedicated) table.

We do have Enhanced e-commerce tracking also modelled after GA, the JSON schema for which is here https://github.com/snowplow/iglu-central/tree/master/schemas/com.google.analytics.enhanced-ecommerce. It might suit your purpose better.


#5

Ok. Actually, we want to send location related info like state, city etc with addTrans() but we dont have such fields in,
https://github.com/snowplow/iglu-central/tree/master/schemas/com.google.analytics.ecommerce
or in
https://github.com/snowplow/iglu-central/tree/master/schemas/com.google.analytics.enhanced-ecommerce

So is there any other context from snowplow so that we can use that context to track state and city while adding transaction in addTrans()


#6

@Dev, I’m confused here. The ecommerce tracking allows you to track state, city, etc. as per https://github.com/snowplow/snowplow/wiki/2-Specific-event-tracking-with-the-Javascript-tracker#331-addtrans. The method addTrans() allows you to do just that.

I think the confusion come from the JSON schema I pointed out initially. That seems to be a “prehistoric” schema. The transaction related values are part of the main payload and as such being loaded to events table, in particular, the columns tr_city, tr_state and tr_country.


#7

snowplow_name_here(‘addTrans’,
‘1234’, // order ID - required
‘Acme Clothing’, // affiliation or store name
‘11.99’, // total - required
‘1.29’, // tax
‘5’, // shipping
‘San Jose’, // city
‘California’, // state or province
‘USA’, // country
‘USD’ // currency
);
This seems good but then how these fields are validated while performing EMR jobs? As per the json schema in that there are no fields for city, state and country also same case for transaction id in item json schema.

As per my understanding if we are passing this info then they should be in self describing schema for such and I can only few of these in JSON you provided.


#8

@Dev, you can disregard that JSON schema.The validation of the main payload (as opposed to custom self-describing events and contexts) is validated in the code itself as its format and the type of data is predefined as per Snowplow tracker protocol: https://github.com/snowplow/snowplow/wiki/snowplow-tracker-protocol#35-ecommerce-tracking.

The code describing the main payload is here. The payload schema is here.