Skip to content

Commit

Permalink
fix: update hotjar to load after amplitude
Browse files Browse the repository at this point in the history
  • Loading branch information
yongenaelf committed Oct 19, 2024
1 parent 9ba0c5b commit 19e0d76
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 39 deletions.
44 changes: 18 additions & 26 deletions .github/workflows/s3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,30 @@ name: Deploy to S3

on:
push:
branches: [ "main", "develop" ]
branches: ["main", "develop"]
workflow_dispatch:

jobs:

build:
environment: ${{ github.ref == 'refs/heads/main' && 'production' || 'development' }}
permissions:
contents: read
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
cache: 'npm'
- run: npm install
- name: create env file
run: |
touch .env
echo TYPESENSE_COLLECTION_NAME=${{ vars.TYPESENSE_COLLECTION_NAME }} >> .env
echo TYPESENSE_SERVER_HOST=${{ vars.TYPESENSE_SERVER_HOST }} >> .env
echo TYPESENSE_SEARCH_ONLY_APIKEY=${{ vars.TYPESENSE_SEARCH_ONLY_APIKEY }} >> .env
echo HOTJAR_ID=${{ vars.HOTJAR_ID }} >> .env
- run: npm run build

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ap-northeast-1

- name: Sync to S3
run: aws s3 sync ./build s3://${{ secrets.AWS_S3_BUCKET }}
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
cache: "npm"
- run: npm install
- run: npm run build

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ap-northeast-1

- name: Sync to S3
run: aws s3 sync ./build s3://${{ secrets.AWS_S3_BUCKET }}
5 changes: 0 additions & 5 deletions docusaurus.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ const config: Config = {
defaultLocale: "en",
locales: ["en"],
},

plugins: ["docusaurus-plugin-hotjar"],
presets: [
[
"classic",
Expand Down Expand Up @@ -110,9 +108,6 @@ const config: Config = {
apiKey: "0e3c2389292b3d211032f3843fa8eb6d",
indexName: "aelf",
},
hotjar: {
applicationId: process.env.HOTJAR_ID,
},
} satisfies Preset.ThemeConfig,
stylesheets: [
{
Expand Down
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@
"@sinm/react-file-tree": "^1.1.1",
"chaingpt-component": "^0.2.0-beta.3",
"clsx": "^2.0.0",
"docusaurus-plugin-hotjar": "^0.0.2",
"dotenv": "^16.4.5",
"prism-react-renderer": "^2.3.0",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"react-ga4": "^2.1.0",
"react-gtm-module": "^2.0.11",
"react-hotjar": "^6.3.1",
"rehype-katex": "^7.0.0",
"remark-math": "^6.0.0"
},
Expand Down
2 changes: 2 additions & 0 deletions src/theme/analytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { gaEventsForwarderPlugin } from "@amplitude/plugin-ga-events-forwarder-b
import { sessionReplayPlugin } from "@amplitude/plugin-session-replay-browser";
import ReactGA from "react-ga4";
import TagManager from "react-gtm-module";
import { hotjar } from "react-hotjar";

export const analytics = () => {
const gaEventsForwarder = gaEventsForwarderPlugin();
Expand All @@ -13,6 +14,7 @@ export const analytics = () => {
});
amplitude.add(sessionReplayTracking);

hotjar.initialize({ id: 5101939, sv: 6 });
ReactGA.initialize("G-PFZ0BCQHMY");
TagManager.initialize({
gtmId: "GTM-NKWDMQ52",
Expand Down

0 comments on commit 19e0d76

Please sign in to comment.