forked from segmentchris/segmentchris.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
234 lines (200 loc) · 9.92 KB
/
index.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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
<html>
<head>
<title>Demo Form</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js" integrity="sha512-894YE6QWD5I59HgZOGReFYm4dnWc1Qt5NtvYSaNcOP+u1T9qYdvdihz0PPSiiqn/+/3e7Jo4EaG7TubfWGUrMQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" integrity="sha384-B0vP5xmATw1+K9KRQjQERJvTumQW0nPEzvF6L/Z6nronJ3oUOFUFpCjEUQouq2+l" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js" integrity="sha384-+YQ4JLhjyBLPDQt//I+STsc9iw4uQqACwlvpslubQzn4u2UU2UFM80nGisd026JF" crossorigin="anonymous"></script>
<script>
!function(){var analytics=window.analytics=window.analytics||[];if(!analytics.initialize)if(analytics.invoked)window.console&&console.error&&console.error("Segment snippet included twice.");else{analytics.invoked=!0;analytics.methods=["trackSubmit","trackClick","trackLink","trackForm","pageview","identify","reset","group","track","ready","alias","debug","page","once","off","on","addSourceMiddleware","addIntegrationMiddleware","setAnonymousId","addDestinationMiddleware"];analytics.factory=function(e){return function(){var t=Array.prototype.slice.call(arguments);t.unshift(e);analytics.push(t);return analytics}};for(var e=0;e<analytics.methods.length;e++){var key=analytics.methods[e];analytics[key]=analytics.factory(key)}analytics.load=function(key,e){var t=document.createElement("script");t.type="text/javascript";t.async=!0;t.src="https://cdn.segment.com/analytics.js/v1/" + key + "/analytics.min.js";var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(t,n);analytics._loadOptions=e};analytics._writeKey="lWOajUEbU0QbTZJLe4LJnq4h8yWbLURj";;analytics.SNIPPET_VERSION="4.15.3";
// analytics.load("0XBnO9NWRsOtu3ERcCQ46CZaTl0XgHMb"); (Customer Test)
analytics.load("lWOajUEbU0QbTZJLe4LJnq4h8yWbLURj");
analytics.page();
}}();
</script>
</head>
<body>
<nav style="text-align: center;">
<a href="/">Home</a>
- <a href="/changeID.html">Change ID</a>
- <a href="/page2.html">Button Events</a>
- <a href="/channels.html">Add Channels</a>
- <a href="/placebet.html">Place Bet</a>
- <a href="/addtrait.html">Custom Trait</a>
- <a href="/analytics-ready.html">Analytics Ready</a>
- <a href="/analytics-exists.html">Analytics Exists</a>
</nav>
<div class="container">
<div class="row ">
<h1 align="center">Chris Carrel Segment Demo Site</h1>
<p>This website is form demonstration purposes only! It provides examples of how to implement the <a href="https://segment.com">Segment CDP</a> into various destinations and a data warehouse.</p>
<p>The data collected on this site will be passed to Segment and be visible during demonstration sessions, so please do not provide any personal information in the following form.</p>
</div></div>
<div class="container h-100">
<div class="row h-100 justify-content-center align-items-center">
<form class="col-12" id="dataform" action="">
<fieldset>
<!-- Form Name -->
<legend>Form Name</legend>
<input id="leadstatus" name="leadstatus" type="hidden" placeholder="" value="New" required="">
<input id="leadsource" name="leadsource" type="hidden" placeholder="" value="Web - Segment" required="">
<!-- Text input-->
<div class="form-group">
<label class="col-md-4 control-label" for="firstname">First Name</label>
<div class="col-md-8">
<input id="firstname" name="firstname" type="text" placeholder="" class="form-control input-md" required="">
</div>
</div>
<!-- Text input-->
<div class="form-group">
<label class="col-md-4 control-label" for="lastname">Last Name</label>
<div class="col-md-8">
<input id="lastname" name="lastname" type="text" placeholder="" class="form-control input-md" required="">
</div>
</div>
<!-- Text input-->
<div class="form-group">
<label class="col-md-4 control-label" for="company">Company</label>
<div class="col-md-8">
<input id="company" name="company" type="text" placeholder="" class="form-control input-md" required="">
</div>
</div>
<div class="form-group">
<label for="industry" class="col-4 col-form-label">Industry</label>
<div class="col-8">
<select id="industry" name="industry" class="custom-select" required="required">
<option value="Commercial">Commercial</option>
<option value="Education">Education</option>
<option value="Financial Services">Financial Services</option>
<option value="Government">Government</option>
<option value="Healthcare">Healthcare</option>
<option value="Insurance">Insurance</option>
</select>
</div>
</div>
<!-- Text input-->
<div class="form-group">
<label class="col-md-4 control-label" for="jobtitle">Job Title</label>
<div class="col-md-8">
<input id="jobtitle" name="jobtitle" type="text" placeholder="" class="form-control input-md">
</div>
</div>
<!-- Text input-->
<div class="form-group">
<label class="col-md-4 control-label" for="emailaddress">Email</label>
<div class="col-md-8">
<input id="emailaddress" name="emailaddress" type="text" placeholder="" class="form-control input-md" required="">
</div>
</div>
<!-- Text input-->
<div class="form-group">
<label class="col-md-4 control-label" for="phonenumber">Phone</label>
<div class="col-md-8">
<input id="phonenumber" name="phonenumber" type="text" placeholder="" class="form-control input-md">
</div>
</div>
<!-- Text input-->
<div class="form-group">
<label class="col-md-4 control-label" for="activity">Activity</label>
<div class="col-md-8">
<input id="activity" name="activity" type="text" placeholder="" class="form-control input-md" required="">
</div>
</div>
<!-- Multiple Radios (inline) -->
<div class="form-group">
<label class="col-md-4 control-label" for="sendsf">Send to SF</label>
<div class="col-md-8">
<label class="radio-inline" for="sendsf-0">
<input type="radio" name="sendsf" id="sendsf-0" value="0" checked="checked">
No
</label>
<label class="radio-inline" for="sendsf-1">
<input type="radio" name="sendsf" id="sendsf-1" value="1">
Yes
</label>
</div>
</div>
<!-- Button -->
<div class="form-group">
<label class="col-md-4 control-label" for="subbtn"></label>
<div class="col-md-8">
<button id="subbtn" name="subbtn" class="btn btn-primary">Submit</button>
</div>
</div>
<div class="row justify-content-center align-items-center">
<form class="col-12" action="/index.html">
<fieldset>
<!-- Button -->
<div class="form-group">
<label class=" control-label" for="resetbtn"></label>
<div class="">
<button id="resetbtn" name="resetbtn" class="btn btn-primary">Reset Analytics</button>
</div>
</div>
</fieldset>
</form>
</div></div>
<script>
function chkForm() {
/*
const fn = $("#firstname").val();
const ln = $("#lastname").val();
const e = $("#emailaddress").val();
const p = $("#phonenumber").val();
const c = $("#company").val();
const j = $("#jobtitle").val();
*/
var required = $('input,textarea,select').filter('[required]:visible');
var allRequired = true;
required.each(function(){
if($(this).val() == ''){
allRequired = false;
}
});
return allRequired;
}
</script>
<script>
$("nav a").on("click", function(){
analytics.track('Menu Link Clicked', {
title: $(this).text(),
});
});
$("#subbtn").on("click", function(){
let validform = chkForm();
let cint = ( $('input[name="sendsf"]:checked').val() == 1 ) ? true : false;
if (validform) {
analytics.identify( {
first_name: $("#firstname").val(),
last_name: $("#lastname").val(),
email: $("#emailaddress").val(),
phone: $("#phonenumber").val(),
company: $("#company").val(),
activity: $("#activity").val(),
job_title: $("#jobtitle").val(),
lead_status: $("#lead_status").val(),
lead_source: $("#leadsource").val(),
industry: $("#industry").children("option:selected").val()
}, {
'integrations': { 'Salesforce': cint }
} );
analytics.track('Form Submitted', {
title: "Sample Form",
status: "SUCCESS"
});
alert("Thank You!");
} else {
analytics.track('Form Submitted', {
title: "Sample Form",
status: "FAILED",
error: "Required Fields Missing"
});
alert("Form Error!");
}
return false;
});
$("#resetbtn").on("click", function () {
analytics.reset();
window.location.assign('./?reset=true');
});
</script>
</body></html>