forked from snowplow/snowplow-javascript-tracker
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsync.html
More file actions
73 lines (69 loc) · 3.19 KB
/
Copy pathsync.html
File metadata and controls
73 lines (69 loc) · 3.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<!--
! Copyright (c) 2012-2013 Snowplow Analytics Ltd. All rights reserved.
!
! This program is licensed to you under the Apache License Version 2.0,
! and you may not use this file except in compliance with the Apache License Version 2.0.
! You may obtain a copy of the Apache License Version 2.0 at http://www.apache.org/licenses/LICENSE-2.0.
!
! Unless required by applicable law or agreed to in writing,
! software distributed under the Apache License Version 2.0 is distributed on an
! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
! See the Apache License Version 2.0 for the specific language governing permissions and limitations there under.
-->
<html>
<head>
<title>Synchronous website/webapp examples for snowplow.js</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<!-- Snowplow starts plowing -->
<script type="text/javascript">
document.write(unescape("%3Cscript src='../sp.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var snowplowTracker = Snowplow.getTrackerCf('d3rkrsqld9gmqf');
snowplowTracker.enableLinkClickTracking();
snowplowTracker.enableActivityTracking(10, 10);
snowplowTracker.encodeBase64(false); // Default is true
snowplowTracker.trackPageView();
} catch ( err ) { }
</script>
<!-- Snowplow stops plowing -->
<!-- Example events -->
<script type="text/javascript">
function playMix() {
alert("Playing a DJ mix");
snowplowTracker.trackStructEvent('Mixes', 'Play', 'MrC/fabric-0503-mix', '','0.0');
}
function addProduct() {
alert("Adding a product to basket");
snowplowTracker.trackStructEvent('Checkout', 'Add', 'ASO01043', 'blue:xxl', '2.0');
}
function viewProduct() {
alert("Viewing a product");
snowplowTracker.trackUnstructEvent('Viewed Product',
{
product_id: 'ASO01043',
category: 'Dresses',
brand: 'ACME',
returning: true,
price: 49.95,
sizes: ['xs', 's', 'l', 'xl', 'xxl'],
available_since$dt: new Date(2013,3,7)
}
);
}
</script>
</head>
<body>
<h1>Synchronous examples for snowplow.js</h1>
<p>Warning: if your browser's Do Not Track feature is enabled and respectDoNotTrack is enabled, all tracking will be prevented.</p>
<p>If you are viewing the page using a file URL, you must edit the script URL in the Snowplow tag to include an http scheme. Otherwise a file scheme will be inferred and the page will attempt to load sp.js from the local filesystem..</p>
<p>Press the buttons below to trigger individual tracking events:<br>
<button type="button" onclick="playMix()">Play a mix</button><br>
<button type="button" onclick="addProduct()">Add a product</button><br>
<button type="button" onclick="viewProduct()">View product</button>
</p>
</body>
</html>