Skip to content

Commit 6062f53

Browse files
authored
Update logic responsible for recording pages views to use correct runtime. (#1047)
1 parent 55979e3 commit 6062f53

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

docs/javascript/extra.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@ const awsconfig = {
99
"aws_kinesis_firehose_stream_name": "ClickStreamKinesisFirehose-OGX7PQdrynUo",
1010
};
1111

12-
const RUNTIME = "python"
12+
const RUNTIME = "java"
13+
const BASE_ORIGIN = "awslabs.github.io"
1314

14-
const attachListeners = () => {
15+
function enableSearchOnBlurElement() {
16+
if (document.location.hostname != BASE_ORIGIN) return // prevent unnecessary data
1517
/* Register handler to log search on blur */
1618
document.addEventListener("DOMContentLoaded", function () {
1719
recordPageView({
@@ -23,7 +25,6 @@ const attachListeners = () => {
2325
// If Search result is ever actionable
2426
// we should populate `value`
2527
if (this.value) {
26-
let path = document.location.pathname;
2728
console.info(`Search value: ${this.value}`)
2829
recordPageView({
2930
searchPattern: this.value
@@ -41,6 +42,10 @@ const attachListeners = () => {
4142
};
4243
}
4344

45+
const attachListeners = () => {
46+
enableSearchOnBlurElement()
47+
}
48+
4449
const init = () => {
4550
Analytics.addPluggable(new KinesisFirehoseProvider())
4651
Amplify.configure(awsconfig);
@@ -68,4 +73,4 @@ const recordPageView = ({prevLocation, searchPattern}) => {
6873
}, 'AWSKinesisFirehose')
6974
}
7075

71-
init()
76+
init()

0 commit comments

Comments
 (0)