Skip to content

Commit 64fc2a0

Browse files
committed
feat: add anonymized click stream to docs view
Signed-off-by: heitorlessa <[email protected]>
1 parent 245bfd8 commit 64fc2a0

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

Diff for: docs/gatsby-browser.js

+25
Original file line numberDiff line numberDiff line change
@@ -1 +1,26 @@
11
import "./src/styles/global.css"
2+
import Amplify from 'aws-amplify';
3+
import { Analytics, AWSKinesisFirehoseProvider } from '@aws-amplify/analytics';
4+
import awsconfig from './src/config';
5+
6+
export const onRouteUpdate = ({ location, prevLocation }) => {
7+
Analytics.record({
8+
data: {
9+
url: window.location.href,
10+
section: location.pathname,
11+
previous: prevLocation ? prevLocation.pathname : null
12+
},
13+
streamName: awsconfig.aws_kinesis_firehose_stream_name
14+
}, 'AWSKinesisFirehose')
15+
}
16+
17+
export const onClientEntry = () => {
18+
Analytics.addPluggable(new AWSKinesisFirehoseProvider());
19+
Amplify.configure(awsconfig);
20+
21+
Analytics.configure({
22+
AWSKinesisFirehose: {
23+
region: awsconfig.aws_project_region
24+
}
25+
});
26+
}

Diff for: docs/src/config.js

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/* eslint-disable */
2+
3+
const awsmobile = {
4+
"aws_project_region": "eu-west-1",
5+
"aws_cognito_identity_pool_id": "eu-west-1:3df3caec-4bb6-4891-b154-ee940c8264b8",
6+
"aws_cognito_region": "eu-west-1",
7+
"aws_kinesis_firehose_stream_name": "ClickStreamKinesisFirehose-OGX7PQdrynUo",
8+
9+
};
10+
11+
12+
export default awsmobile;

0 commit comments

Comments
 (0)