Skip to content

Instantly share code, notes, and snippets.

@Haolicopter
Last active May 28, 2018 19:44
Show Gist options
  • Save Haolicopter/d9a6fb272695f470e2a75da05b795a94 to your computer and use it in GitHub Desktop.
Save Haolicopter/d9a6fb272695f470e2a75da05b795a94 to your computer and use it in GitHub Desktop.
Snowplow test tracker
<!DOCTYPE html>
<html>
<head>
<title>Snowplow test tracker</title>
<script>
; (function (p, l, o, w, i, n, g) {
if (!p[i]) {
p.GlobalSnowplowNamespace = p.GlobalSnowplowNamespace || [];
p.GlobalSnowplowNamespace.push(i); p[i] = function () {
(p[i].q = p[i].q || []).push(arguments)
}; p[i].q = p[i].q || []; n = l.createElement(o); g = l.getElementsByTagName(o)[0]; n.async = 1;
n.src = w; g.parentNode.insertBefore(n, g)
}
}(window, document, "script", "https://d1fc8wv8zag5ca.cloudfront.net/2.8.2/sp.js", "snowplow"));
window.snowplow("newTracker", "cf", "analytics.jumbledev.com", {
appId: "cfe23aiocd",
cookieName: "_sp534asf_",
userFingerprint: true,
forceSecureTracker: true,
post: true
});
window.snowplow(
'trackPageView',
'landing page',
[
{
schema: 'https://raw.githubusercontent.com/Jumbleberry/snowplow-schemas/master/metadata.json',
data: {
affiliate_id: 380001,
c1: 'c1 info: affiliate id as integer',
}
},
{
schema: 'https://raw.githubusercontent.com/Jumbleberry/snowplow-schemas/master/metadata.json',
data: {
affiliate_id: '380001',
c1: 'c1 info: affiliate id as string',
}
}
]
);
window.snowplow('enableActivityTracking', 10, 10);
window.snowplow('trackStructEvent', 'category', 'action', 'label', 'property', 'value');
window.snowplow('trackSelfDescribingEvent', {
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']
}
});
</script>
</head>
<body>
Snowplow Test Tracker
<p>
You may wish to track events on your website or application which are not directly supported by Snowplow and which structured
event tracking does not adequately capture. Your event may have more than the five fields offered by trackStructEvent,
or its fields may not fit into the category-action-label-property-value model. The solution is Snowplow's self-describing
events (previously known as unstructured). Self-describing events use JSONs which can have arbitrarily many fields.
</p>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment