-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtests.html
118 lines (118 loc) · 2.89 KB
/
tests.html
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<!DOCTYPE html>
<html>
<head>
<title>Cabin client-script tests</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style>
body {
font-family: sans-serif;
padding: 30px;
line-height: 140%;
}
button {
cursor: pointer;
appearance: none;
background: #eee;
border: 0;
padding: 5px 10px;
display: inline-block;
margin-bottom: 5px;
}
.button:active {
background: #ccc;
}
h2 {
font-size: 1em;
text-transform: uppercase;
color: #ccc;
margin-top: 2em;
margin-bottom: 2em;
}
p {
margin-left: 2em;
}
a {
color: inherit;
font-size: 0.85em;
}
</style>
</head>
<body>
<h1>Cabin client-script tests: {title}</h1>
<pre id="result"></pre>
<h2>Links</h2>
<p><a href="{linkTo}">{linkTo}</a><br />
<a href="#events">Events</a><br />
<a href="#campaigns">Campaigns</a><br />
</p>
<h2 id="events">JS Events</h2>
<p>
<button onclick="javascript:cabin.event('Newsletter signup')">
Trigger (Newsletter Signup)
</button>
<br />
<button onclick="javascript:cabin.event('Video / Play / Intro')">
Trigger (Video / Play / Intro)
</button>
<br />
<button
onclick="javascript:cabin.event('Result: https://my-awesome-website.com/')"
>
With URL
</button>
</p>
<h2>Attr Events</h2>
<p>
<button
id="hello"
onclick="javascript:alert('Hi there!')"
data-cabin-event="Saying hello"
>
Trigger alert with cabin-data-event
</button>
<br />
<button onclick="javascript:cabin.initEvents()">
Re-initialise attr events
</button>
<br />
<a href="{linkTo}" data-cabin-event="Leaving index event"
>Link with cabin-data-event</a
>
<br />
<button
data-cabin-event="Result: https://my-awesome-website.com/"
>
Trigger with Result: https://my-awesome-website.com/
</button>
</p>
<hd id="campaigns">UTM Campaigns</h2>
<p>
<a
href="http://mulhoon.local:8000?utm_source=facebook&utm_medium=cpc&utm_campaign=spring_sale"
>
'spring_sale' campaign via facebook ad </a
><br />
<a
href="http://mulhoon.local:8000?utm_source=facebook&utm_medium=share&utm_campaign=spring_sale"
>
'spring_sale' campaign via facebook share </a
><br />
<a
href="http://mulhoon.local:8000?utm_source=newsletter&utm_medium=email&utm_campaign=50%25_discount"
>
'50%_discount' campaign via newsletter </a
><br />
<a
href="http://mulhoon.local:8000?utm_source=instagram&utm_medium=social&utm_campaign=50%25_discount"
>
'50%_discount' campaign via instagram </a
><br />
</p>
<script async defer src="/hello.js?host=mulhoon.local:8080"></script>
<script>
let link = document.getElementById('hello')
link.addEventListener('click', (e) => console.log('first event'))
</script>
<!-- <script async defer src="https://scripts.withcabin.com/hello.js"></script> -->
</body>
</html>