Skip to content

Instantly share code, notes, and snippets.

@fblundun
Last active August 29, 2015 14:04
Show Gist options
  • Save fblundun/58f4565f353cb6a202ce to your computer and use it in GitHub Desktop.
Save fblundun/58f4565f353cb6a202ce to your computer and use it in GitHub Desktop.
Unstructured event with contexts
// An unstructured event with no context attached
window.snowplow_name_here('trackUnstructEvent', {
schema: 'iglu:com.acme_company/viewed_product/jsonschema/2-0-0',
data: {
productId: 'ASO01043',
category: 'Dresses',
brand: 'ACME',
returning: true,
price: 49.95,
sizes: ['xs', 's', 'l', 'xl', 'xxl'],
availableSince: new Date(2013,3,7)
}
});
// The same unstructured event, with two custom contexts attached -
// one regarding the page background and one regarding the user type
window.snowplow_name_here('trackUnstructEvent', {
schema: 'iglu:com.acme_company/viewed_product/jsonschema/2-0-0',
data: {
productId: 'ASO01043',
category: 'Dresses',
brand: 'ACME',
returning: true,
price: 49.95,
sizes: ['xs', 's', 'l', 'xl', 'xxl'],
availableSince: new Date(2013,3,7)
}
},
[
{
schema: "iglu:com.mycompany/page_style/jsonschema/1-0-0",
data: {
background_color: "white",
font_size: 12
}
},
{
schema: "iglu:com.mycompany/user_type/jsonschema/1-0-0",
data: {
type: "tester"
}
}
]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment