Skip to content

Commit fda0553

Browse files
committed
Improvements to source code, AI integrations, and minor bug fixes
1 parent d005246 commit fda0553

13 files changed

Lines changed: 1626 additions & 324 deletions

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
assets/js/function.js
22
assets/js/config.js
33
server/.env
4+
server/credentials.json
45
server/node_modules/

assets/css/chatbot.css

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
:root {
22
--primary-color: purple;
3+
--secondary-color: rgb(200, 146, 200);
34
--text-color: #ffffff;
45
--border-color: #dddddd;
56
}
@@ -25,8 +26,8 @@
2526
position: fixed;
2627
bottom: 100px;
2728
right: 40px;
28-
width: 320px;
29-
max-height: 500px;
29+
width: 400px;
30+
max-height: 600px;
3031
background: var(--text-color);
3132
border: 1px solid var(--border-color);
3233
border-radius: 8px;
@@ -79,7 +80,7 @@
7980
}
8081

8182
.user-message {
82-
background-color: var(--primary-color);
83+
background-color: var(--secondary-color);
8384
color: var(--text-color);
8485
align-self: flex-end;
8586
margin-left: auto;
@@ -120,3 +121,21 @@
120121
#send-btn:hover {
121122
background-color: red;
122123
}
124+
125+
@media screen and (min-width: 320px) and (max-width: 550px) {
126+
.chat-toggle {
127+
bottom: 70px;
128+
right: 15px;
129+
img {
130+
width: 80px;
131+
height: 85px;
132+
}
133+
}
134+
.chatbot-widget {
135+
width: 96%;
136+
max-height: 750px;
137+
bottom: 60px;
138+
right: 8px;
139+
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
140+
}
141+
}

assets/css/style.css

Lines changed: 43 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -992,24 +992,63 @@ aside {
992992
text-align: justify;
993993
}
994994

995-
@media screen and (min-width: 320px) and (max-width: 1280px) {
995+
@media screen and (min-width: 320px) and (max-width: 550px) {
996996
.github-badges {
997997
display: inline-block;
998998
margin: auto 0;
999999
}
10001000
.flex {
1001-
flex-wrap: wrap;
10021001
margin: 15px 10px 0;
10031002
}
10041003
.button {
1005-
margin: 0 auto 10px;
1004+
margin: 0 5px 10px;
10061005
}
10071006
main {
10081007
margin: 0 10px 65px;
10091008
font-size: 90%;
10101009
}
10111010
footer {
1012-
font-size: 10px;
1011+
font-size: 0.5rem;
1012+
}
1013+
.container {
1014+
display: flex;
1015+
}
1016+
.ecommerce-modal-content {
1017+
width: 80%;
1018+
}
1019+
.ecommerce-btn {
1020+
left: 88%;
1021+
margin: 20px 0 0 -40%;
1022+
}
1023+
.ecommerce-btn2 {
1024+
left: 88%;
1025+
margin: 1px 0 0 -40%;
1026+
}
1027+
.cookie-consent-banner {
1028+
padding-top: 50px;
1029+
}
1030+
.text-consent-banner {
1031+
width: 70%;
1032+
}
1033+
}
1034+
1035+
@media screen and (min-width: 551px) and (max-width: 1280px) {
1036+
.github-badges {
1037+
display: inline-block;
1038+
margin: auto 0;
1039+
}
1040+
.flex {
1041+
margin: 15px 10px 0;
1042+
}
1043+
.button {
1044+
margin: 0 5px 10px;
1045+
}
1046+
main {
1047+
margin: 0 10px 65px;
1048+
font-size: 90%;
1049+
}
1050+
footer {
1051+
font-size: 0.8rem;
10131052
}
10141053
.container {
10151054
display: flex;

assets/js/config.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/js/function.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

index.html

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282
language_code: "en-US",
8383
page_author: "Arturo Santiago-Rivera",
8484
page_category: "home",
85-
page_name: "Web Analytics Implementation - Internal Page",
85+
page_name: "Web Analytics Implementation - Homepage",
8686
page_title: document.querySelector("title").innerText,
8787
};
8888
window.dataLayer = window.dataLayer || [];
@@ -112,7 +112,7 @@
112112
</script>
113113
<!--END: Google Tag Manager-->
114114
<!--Amplitude Script Loader-->
115-
<script src="https://cdn.amplitude.com/libs/analytics-browser-2.11.3-min.js.gz"></script>
115+
<script src="https://cdn.amplitude.com/libs/analytics-browser-2.11.12-min.js.gz"></script>
116116
<!--END: Amplitude Script Loader-->
117117
<!--Mixpanel Script Loader-->
118118
<script type="text/javascript">
@@ -290,13 +290,13 @@
290290
return event;
291291
},
292292
});
293-
amplitude.add(enrichEventsPlugin()); // amplitude enrich plugin call
294-
amplitude.init(config.AMPLITUDE_KEY, userInit, {
293+
window.amplitude.add(enrichEventsPlugin()); // amplitude enrich plugin call
294+
window.amplitude.init(insightTool.AMPLITUDE_KEY, userInit, {
295295
autocapture: { elementInteractions: false },
296296
}); // amplitude init statement
297297

298298
/* Mixpanel Init */
299-
mixpanel.init(config.MIXPANEL_KEY); // mixpanel init statement
299+
mixpanel.init(insightTool.MIXPANEL_KEY); // mixpanel init statement
300300
mixpanel.identify(userInit); // mixpanel user identify
301301
mixpanel.people.set({ logged_in: localStorage.logged }); // mixpanel user properties
302302
mixpanel.register({
@@ -308,7 +308,9 @@
308308

309309
/* Heap Analytics Init */
310310
const heapAppId =
311-
tealiumEnv !== "prod" ? config.HEAP_DEV_KEY : config.HEAP_PROD_KEY;
311+
tealiumEnv !== "prod"
312+
? insightTool.HEAP_DEV_KEY
313+
: insightTool.HEAP_PROD_KEY;
312314
heap.load(heapAppId);
313315
heap.identify(userInit);
314316
heap.addUserProperties({ logged_in: localStorage.logged });
@@ -378,8 +380,8 @@ <h1>
378380
<h2>
379381
A playground for experimenting with analytics implementation on a web
380382
app tracked on Google Analytics 4 (GA4) through GTM, Adobe Analytics
381-
(AA) via Tealium iQ, Amplitude Analytics, and Mixpanel Product
382-
Analytics.
383+
(AA) via Tealium iQ, Amplitude Analytics, Mixpanel Product Analytics,
384+
New Relic LogRocket and TrackingPlan.
383385
</h2>
384386
<h3>
385387
Adobe Data Collection (Launch), Heap Analytics, and LaunchDarkly are
@@ -433,7 +435,7 @@ <h3>
433435
<i class="fa-solid fa-check icon"></i>
434436
</a>
435437
<a
436-
id="intlink2"
438+
id="iframelink"
437439
name="action"
438440
class="button n-item"
439441
href="public/iframe-parent.html"
@@ -1291,7 +1293,7 @@ <h2>We value your privacy</h2>
12911293
</section>
12921294
</main>
12931295
<footer></footer>
1294-
<!-- Chatbot TStructure -->
1296+
<!-- Chatbot Structure -->
12951297
<button
12961298
id="chat-toggle"
12971299
class="chat-toggle hidden"
@@ -1308,7 +1310,7 @@ <h2>We value your privacy</h2>
13081310
</button>
13091311
<div id="chatbot-widget" class="chatbot-widget hidden">
13101312
<div class="chatbot-header">
1311-
<span>Chatbot</span>
1313+
<span>AnalyticsWeb Assistant</span>
13121314
<button
13131315
id="close-chat"
13141316
class="close-btn"

public/iframe-child.html

Lines changed: 30 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,28 @@
1-
<!DOCTYPE html>
1+
<!doctype html>
22
<html lang="en-US">
3-
43
<head>
54
<meta charset="UTF-8" />
65
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7-
<meta name="description"
8-
content="Playground to explore web analytics implementation on a web app using various analytics tools." />
6+
<meta
7+
name="description"
8+
content="Playground to explore web analytics implementation on a web app using various analytics tools."
9+
/>
910
<meta name="author" content="Arturo Santiago-Rivera" />
1011
<meta name="author_email" content="asantiago@arsari.com" />
11-
<meta http-equiv='cache-control' content='no-cache'>
12-
<meta http-equiv='expires' content='0'>
13-
<meta http-equiv='pragma' content='no-cache'>
14-
<link rel="shortcut icon" type="image/x-icon" sizes="16x16" href="../favicon.ico" />
15-
<link rel='canonical' href='https://arsari.github.io/AnalyticsWeb' />
16-
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Roboto&display=swap">
12+
<meta http-equiv="cache-control" content="no-cache" />
13+
<meta http-equiv="expires" content="0" />
14+
<meta http-equiv="pragma" content="no-cache" />
15+
<link
16+
rel="shortcut icon"
17+
type="image/x-icon"
18+
sizes="16x16"
19+
href="../favicon.ico"
20+
/>
21+
<link rel="canonical" href="https://arsari.github.io/AnalyticsWeb" />
22+
<link
23+
rel="stylesheet"
24+
href="https://fonts.googleapis.com/css2?family=Roboto&display=swap"
25+
/>
1726
<link rel="stylesheet" href="../assets/css/style.css" />
1827
<title>AnalyticsWeb | Child iFrame Page</title>
1928
<script type="text/javascript" src="../assets/js/newRelic.js"></script>
@@ -60,30 +69,29 @@
6069
function sendTrackingEventParent(eventName, eventData) {
6170
try {
6271
const postObject = {
63-
event: 'iframeEvent',
72+
event: "iframeEvent",
6473
name: eventName,
6574
data: eventData,
6675
};
67-
window.parent.postMessage(postObject, '*');
76+
window.parent.postMessage(postObject, "*");
6877
} catch (e) {
69-
console.error('Error sending message to parent', e);
78+
console.error("Error sending message to parent", e);
7079
}
7180
}
7281

73-
const elAction = document.getElementById('thankButton');
74-
elAction.addEventListener('click', () => {
75-
document.getElementById('thankMessage').style.display = 'block';
76-
elAction.style.display = 'none';
77-
sendTrackingEventParent('iframe_button_click', {
82+
const elAction = document.getElementById("thankButton");
83+
elAction.addEventListener("click", () => {
84+
document.getElementById("thankMessage").style.display = "block";
85+
elAction.style.display = "none";
86+
sendTrackingEventParent("iframe_button_click", {
7887
button_text: elAction.innerText,
7988
tag_name: elAction.tagName,
8089
});
8190
setTimeout(() => {
82-
document.getElementById('thankMessage').style.display = 'none';
83-
elAction.style.display = 'block';
91+
document.getElementById("thankMessage").style.display = "none";
92+
elAction.style.display = "block";
8493
}, 1000);
8594
});
8695
</script>
8796
</body>
88-
89-
</html>
97+
</html>

public/iframe-parent.html

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@
4949
e_timestamp: String(new Date().getTime()), // milliseconds
5050
language_code: "en-US",
5151
page_author: "Arturo Santiago-Rivera",
52-
page_category: "iframe",
53-
page_name: "Web Analytics Implementation - Internal Page",
52+
page_category: "internal",
53+
page_name: "Web Analytics Implementation - iFrame Page",
5454
page_title: document.querySelector("title").innerText,
5555
};
5656
window.dataLayer = window.dataLayer || [];
@@ -80,8 +80,8 @@
8080
</script>
8181
<!--End Google Tag Manager-->
8282
<!--Amplitude Script Loader-->
83-
<script src="https://cdn.amplitude.com/libs/analytics-browser-2.11.3-min.js.gz"></script>
84-
<!--End Amplitude Script Loader-->
83+
<script src="https://cdn.amplitude.com/libs/analytics-browser-2.11.12-min.js.gz"></script>
84+
<!--END: Amplitude Script Loader-->
8585
<!--Mixpanel Script Loader-->
8686
<script type="text/javascript">
8787
(function (f, b) {
@@ -259,12 +259,12 @@
259259
},
260260
});
261261
amplitude.add(enrichEventsPlugin()); // amplitude enrich plugin call
262-
amplitude.init(config.AMPLITUDE_KEY, userInit, {
262+
amplitude.init(insightTool.AMPLITUDE_KEY, userInit, {
263263
autocapture: { elementInteractions: false },
264264
}); // amplitude init statement
265265

266266
/* Mixpanel Init */
267-
mixpanel.init(config.MIXPANEL_KEY); // mixpanel init statement
267+
mixpanel.init(insightTool.MIXPANEL_KEY); // mixpanel init statement
268268
mixpanel.identify(userInit); // mixpanel user identify
269269
mixpanel.people.set({ logged_in: false }); // mixpanel user properties
270270
mixpanel.register({
@@ -276,30 +276,24 @@
276276

277277
/* Heap Analytics Init */
278278
const heapAppId =
279-
tealiumEnv !== "prod" ? config.HEAP_DEV_KEY : config.HEAP_PROD_KEY;
279+
tealiumEnv !== "prod"
280+
? insightTool.HEAP_DEV_KEY
281+
: insightTool.HEAP_PROD_KEY;
280282
heap.load(heapAppId);
281283
heap.identify(userInit);
282284
heap.addUserProperties({ logged_in: localStorage.logged });
283285
</script>
284286
<!-- END Tracking Variables Setup -->
285287
<!-- Tracking Plan Loader -->
286-
<script type="text/javascript" src="assets/js/trackingplan.js"></script>
288+
<script type="text/javascript" src="../assets/js/trackingplan.js"></script>
287289
<!-- END: Tracking Plan Loader -->
288290
</head>
289291

290292
<body>
291293
<!-- utag data object message -->
292294
<script type="text/javascript">
293295
const utag_data = {
294-
author_email: "asantiago@arsari.com",
295-
content_group: "Implementation",
296-
content_type: "Playground",
297-
e_timestamp: String(new Date().getTime()), // milliseconds
298-
language_code: "en-US",
299-
page_author: "Arturo Santiago-Rivera",
300-
page_category: "iframe",
301-
page_name: "Web Analytics Implementation - Internal Page",
302-
page_title: document.querySelector("title").innerText,
296+
...INIT_PROPERTIES,
303297
// user properties
304298
custom_user_id: userInit,
305299
logged_in: localStorage.logged ?? false,

0 commit comments

Comments
 (0)