forked from aws-powertools/powertools-lambda-java
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgatsby-browser.js
27 lines (24 loc) · 829 Bytes
/
gatsby-browser.js
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
27
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,
language: 'java'
},
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
}
});
}