From 62ffe3fe256077c54fdd9a72cc0d4439d57395a7 Mon Sep 17 00:00:00 2001 From: kozub Date: Fri, 10 Feb 2023 11:06:58 +0100 Subject: [PATCH] Update logic responsible for recording pages views to use correct runtime. --- docs/javascript/extra.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/docs/javascript/extra.js b/docs/javascript/extra.js index 0ade322a6..6e9193366 100644 --- a/docs/javascript/extra.js +++ b/docs/javascript/extra.js @@ -9,9 +9,11 @@ const awsconfig = { "aws_kinesis_firehose_stream_name": "ClickStreamKinesisFirehose-OGX7PQdrynUo", }; -const RUNTIME = "python" +const RUNTIME = "java" +const BASE_ORIGIN = "awslabs.github.io" -const attachListeners = () => { +function enableSearchOnBlurElement() { + if (document.location.hostname != BASE_ORIGIN) return // prevent unnecessary data /* Register handler to log search on blur */ document.addEventListener("DOMContentLoaded", function () { recordPageView({ @@ -23,7 +25,6 @@ const attachListeners = () => { // If Search result is ever actionable // we should populate `value` if (this.value) { - let path = document.location.pathname; console.info(`Search value: ${this.value}`) recordPageView({ searchPattern: this.value @@ -41,6 +42,10 @@ const attachListeners = () => { }; } +const attachListeners = () => { + enableSearchOnBlurElement() +} + const init = () => { Analytics.addPluggable(new KinesisFirehoseProvider()) Amplify.configure(awsconfig); @@ -68,4 +73,4 @@ const recordPageView = ({prevLocation, searchPattern}) => { }, 'AWSKinesisFirehose') } -init() +init() \ No newline at end of file