forked from aws-powertools/powertools-lambda-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgatsby-browser.js
More file actions
26 lines (23 loc) · 799 Bytes
/
gatsby-browser.js
File metadata and controls
26 lines (23 loc) · 799 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import "./src/styles/global.css"
import Amplify from 'aws-amplify';
import { Analytics, AWSKinesisFirehoseProvider } from '@aws-amplify/analytics';
import awsconfig from './src/config';
export const onRouteUpdate = ({ location, prevLocation }) => {
Analytics.record({
data: {
url: window.location.href,
section: location.pathname,
previous: prevLocation ? prevLocation.pathname : null
},
streamName: awsconfig.aws_kinesis_firehose_stream_name
}, 'AWSKinesisFirehose')
}
export const onClientEntry = () => {
Analytics.addPluggable(new AWSKinesisFirehoseProvider());
Amplify.configure(awsconfig);
Analytics.configure({
AWSKinesisFirehose: {
region: awsconfig.aws_project_region
}
});
}