Skip to content

Commit

Permalink
Add amplitude analytics
Browse files Browse the repository at this point in the history
  • Loading branch information
bcbogdan committed Jan 2, 2025
1 parent d96fb44 commit a1673db
Show file tree
Hide file tree
Showing 30 changed files with 1,549 additions and 327 deletions.
38 changes: 19 additions & 19 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,10 @@ jobs:
- image: cimg/node:18.0
steps:
- checkout
- run: git clone --depth=1 [email protected]:supertokens/supertokens-backend-website.git --branch=docs-v3 supertokens-backend-website
- run: git clone --depth=1 [email protected]:supertokens/supertokens-backend-website.git --branch=master supertokens-backend-website
- attach_workspace:
at: ./workspace
- run: git config --global user.email "$EMAIL" && git config --global user.name "$NAME"
# - run: cd supertokens-backend-website && git checkout -b test-new-docs-branch
- run:
name: Copy Docusaurus Build to Backend Website Folder
command: |
Expand All @@ -66,8 +65,9 @@ jobs:
cd supertokens-backend-website
git add --all
git commit -m "docs changes"
git push origin master
./releaseDev.sh
# - slack/status
- slack/status
run-code-type-checking:
machine:
image: ubuntu-2204:current
Expand All @@ -79,7 +79,7 @@ jobs:
language: "go"
- code-type-check:
language: "python"
# - slack/status
- slack/status
run-code-type-checking-ios:
macos:
xcode: 14.1.0
Expand All @@ -101,21 +101,21 @@ workflows:
version: 2
build-and-deploy:
jobs:
- build-docs
- build-docs:
filters:
branches:
only:
- master
- create-supertokens-backend-website-dev-tag:
requires:
- build-docs
# filters:
# branches:
# only:
# - master
# code-type-checking:
# jobs:
# - build-code-type-checking
# - run-code-type-checking:
# requires:
# - build-code-type-checking
# filters:
# branches:
# only:
# - master
code-type-checking:
jobs:
- build-code-type-checking:
filters:
branches:
only:
- master
- run-code-type-checking:
requires:
- build-code-type-checking
8 changes: 3 additions & 5 deletions v3/docusaurus.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ const config: Config = {
onBrokenMarkdownLinks:
process.env.NODE_ENV === "production" ? "throw" : "warn",
future: {
experimental_faster: true,
// Use rspack only during the build phase for faster CI times
// In dev mode it crashes often while hot reloading
experimental_faster: process.env.NODE_ENV === "production" ? true : false,
},
// Even if you don't use internationalization, you can use this field to set
// useful metadata like html lang. For example, if your site is Chinese, you
Expand Down Expand Up @@ -130,10 +132,6 @@ const config: Config = {
// },
// ],
].filter(Boolean),
clientModules: [
//used to intercept client side navigation and fire analytics events.
require.resolve("./src/plugins/locationInterceptor"),
],
};

// As far as I can tell docusaurus doesn't export this type
Expand Down
133 changes: 128 additions & 5 deletions v3/package-lock.json

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

5 changes: 4 additions & 1 deletion v3/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"ai": "bun run scripts/ai"
},
"dependencies": {
"@amplitude/analytics-browser": "^2.11.11",
"@docsearch/react": "^3.6.2",
"@docusaurus/core": "3.6.2",
"@docusaurus/plugin-client-redirects": "^3.6.2",
Expand All @@ -33,13 +34,15 @@
"clsx": "^2.0.0",
"docusaurus-plugin-sass": "^0.2.5",
"dotenv": "^16.4.5",
"js-cookie": "^3.0.5",
"motion": "^11.13.1",
"prism-react-renderer": "^2.3.0",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"sass": "^1.80.6",
"supertokens-website": "^20.1.5",
"tailwind-merge": "^2.5.5"
"tailwind-merge": "^2.5.5",
"uuid": "^11.0.3"
},
"devDependencies": {
"@docusaurus/faster": "^3.6.3",
Expand Down
13 changes: 10 additions & 3 deletions v3/src/components/Cards/ReferenceCard/ReferenceCard.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import React from "react";
import React, { useCallback } from "react";
import { Card, Flex, Avatar, Grid, Box, Text } from "@radix-ui/themes";
import Link from "@docusaurus/Link";

import "./styles.scss";
import { trackButtonClick } from "@site/src/lib/analytics";

function ReferenceCardRoot({
children,
Expand All @@ -15,11 +16,17 @@ function ReferenceCardRoot({
return false;
});

const onClick = useCallback(() => {
trackButtonClick("button_reference_card", "v1", {
href,
});
}, [href]);

if (hasAvatarInChildren) {
return (
<Box p="4" asChild>
<Card className="reference-card" asChild>
<Link to={href}>
<Link to={href} onClick={onClick}>
<Flex gap="3" align="center">
{children}
</Flex>
Expand All @@ -32,7 +39,7 @@ function ReferenceCardRoot({
return (
<Box p="5" asChild>
<Card className="reference-card">
<Link to={href}>
<Link to={href} onClick={onClick}>
<Flex gap="3" direction="column">
{children}
</Flex>
Expand Down
Loading

0 comments on commit a1673db

Please sign in to comment.