Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update logic responsible for recording pages views to use correct run… #1047

Merged
merged 1 commit into from
Feb 10, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions docs/javascript/extra.js
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand All @@ -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
Expand All @@ -41,6 +42,10 @@ const attachListeners = () => {
};
}

const attachListeners = () => {
enableSearchOnBlurElement()
}

const init = () => {
Analytics.addPluggable(new KinesisFirehoseProvider())
Amplify.configure(awsconfig);
Expand Down Expand Up @@ -68,4 +73,4 @@ const recordPageView = ({prevLocation, searchPattern}) => {
}, 'AWSKinesisFirehose')
}

init()
init()