-
Notifications
You must be signed in to change notification settings - Fork 0
/
web-segment.html
181 lines (172 loc) · 9.67 KB
/
web-segment.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
<html>
<head>
<!-- <script type="text/javascript">
!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="YsbH9ky3j4t08cL94VXjCRN0DbkjUxL2";;analytics.SNIPPET_VERSION="4.15.3";
analytics.load("YsbH9ky3j4t08cL94VXjCRN0DbkjUxL2");
analytics.page();
}}();
</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="2gMm9KWzK7Sh3Di1bch8LT2CtbMAFSe9";;analytics.SNIPPET_VERSION="4.15.3";
analytics.load("2gMm9KWzK7Sh3Di1bch8LT2CtbMAFSe9");
analytics.page();
}}();
</script>
</head>
<style>
body {
background-color: #f2f2f2;
}
.newH{
font-weight: 300; font-size: 30px; padding-top: 18px; padding-bottom: 5px;
}
.newH2{
font-weight: 300; font-size: 26px; padding-bottom: 14px;
}
#RootCauseAnalysisProgress {
width: 100%;
background-color: white;
}
#RootCauseAnalysisBar {
width: 0%;
height: 20px;
background-color: #4CAF50;
}
#stage1progress, #stage2progress {
width: 100%;
background-color: white;
}
#stage1bar, #stage2bar {
width: 0%;
height: 20px;
background-color: #4CAF50;
}
.subnav__link:hover{
cursor: pointer;
}
</style>
<head><link rel="stylesheet" href="https://cdn-staging.braze.com/appboy/communication/assets/code_assets/files/6306f04130076a758f1a6c1f/original.css?1661399105" /></head>
<body class="theme--blue">
<div id='top' class="nav has-no-secondary">
<a class="nav__brand" href="https://www.nthstar.co/">
<img class="nav__logo" style='height: 26px; 'src="https://cdn-staging.braze.com/appboy/communication/assets/image_assets/images/62fc6d24582c611eadf23c3d/original.png?1660710180" alt="North Star logo"/>
</a>
<!--<div class="nav__buttongroup">
<button data-target="#nav-bar-example1" class="nav__btn nav__btn--menutoggle">Menu</button>
</div>-->
<nav id="nav-bar-example1" class="nav__bar">
<ul class="nav__list nav__list--primary">
<li class="nav__item">
<a class="nav__link" href="https://www.nthstar.co"></a>
</li>
</ul>
</nav>
</div>
<div id='topSub' class="subnav">
<nav class="subnav__bar">
<ul class="subnav__list">
<li class="subnav__item is-current">
<a class="subnav__link">Segment x Braze SDK</a>
</li>
</ul>
</nav>
</div>
<div id='Home'>
<div class="layout has-islands">
<div class="layout__container layout--full">
<div class="island">
<div class="infochip">
<div class="infochip__icon">
<img class="icon icon--blue--big" src='https://webinole.k8s.tools-001.p-use-1.braze.com/logo.png' style='height: 86px; width: 51px;'></img>
</div>
<div class="infochip__desc">
<div class="infochip__desc__title" title="Title">
<div class='newH'>Segment x Braze SDK</div>
</div>
<div>Segment <a href="https://github.com/segmentio/analytics-next/">Analytics.js 2.0</a> handles events augmentation for Braze SDK (device-mode)</div>
</div>
</div>
<br>
<span tabindex="1" class="tag">
<span class="tag__key">Contact: ken.lee@partners.braze.com</span>
</span>
<br>
<p>The <a href="https://segment.com/docs/connections/destinations/actions/">Destination Actions</a> framework lets you choose exactly how you want your Segment data to map to a destination.</p>
<p>The program will demonstrate how the destination (Braze) data mapping and event filters can be configured through Segment UI and how Segment augment every matching events that are in transit to Braze using Braze SDK. </p>
</div>
<div class="island">
<field class='field' style="width: 50%">
<label for="i0" class="label">User Id:</label>
<input type="text" class="inputfield" id="userid"/>
</field>
<field class='field' style="width: 50%">
<label for="i0" class="label">Traits (json format)</label>
<input type="text" class="inputfield" id="traitvalue"/>
<BR><br>
<button role="button" type="button" class="btn btn--primary theme--dark" onclick="identify();">Analytics.identify()</button>
</field>
<br><br>
<field class='field' style="width: 50%">
<label for="i0" class="label">Event</label>
<input type="text" class="inputfield" id="eventname"/>
</field>
<field class='field' style="width: 50%">
<label for="i0" class="label">Properties (json format)</label>
<field class='left' style="width: 50%">
<!--<input type="text" class="inputfield" id="propertyname"/>-->
<input type="text" class="inputfield" id="propertyvalue"/>
</field>
<br><br>
<button role="button" type="button" class="btn btn--primary theme--dark" onclick="track();">Analytics.track()</button>
</field>
<br>
<br>
</div>
<div class="island" id='DebugIsland' style="display: none">
<table class='table'>
<thead>
<tr><td>Title</td></tr>
</thead>
<tbody id='DebugTable'></tbody>
</table>
</div>
</div>
</div>
</div>
</body>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script type="text/javascript" src="https://cdn-staging.braze.com/appboy/communication/assets/code_assets/files/6306f04930076a758f1a6c20/original.js?1661399113"></script>
<script>
function track() {
let eventName = '';
let jsonData = {};
let s = '';
s = document.getElementById('propertyvalue').value;
eventName = document.getElementById('eventname').value;
if (s.length== 0) {
analytics.track(eventName);
}
else {
jsonData = JSON.parse(s);
analytics.track(eventName, jsonData);
//console.log("Event " + eventName + " with event properties: " + eventProperties + " logged.");
}
}
function identify() {
let userID = '';
let jsonData = {};
let s = '';
s = document.getElementById('traitvalue').value;
userID = document.getElementById('userid').value;
//jsonData[document.getElementById('traitid').value] = document.getElementById('traitvalue').value;
if (s.length==0) {
analytics.identify(userID);
}
else {
jsonData = JSON.parse(s);
analytics.identify(userID, jsonData);
//console.log("Event " + eventName + " with event properties: " + eventProperties + " logged.");
}
}
</script>
</html>