Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,7 @@ GOOGLE_CALLBACK_URL=http://localhost:3000/auth/google/callback
GITHUB_CLIENT_ID=your-github-client-id
GITHUB_CLIENT_SECRET=your-github-client-secret
GITHUB_CALLBACK_URL=http://localhost:3000/auth/github/callback

# Google Analytics Configuration (optional)
# Get your tracking ID from https://analytics.google.com
GA_TRACKING_ID=
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,20 @@ Edit `src/App.vue` to customize the appearance and functionality of the frontend

You can enable or disable OAuth providers by setting or removing their credentials in the `.env` file. At least one provider must be configured for authentication to work.

### Set Up Google Analytics (Optional)

To track user analytics with Google Analytics:

1. Create a Google Analytics account at [analytics.google.com](https://analytics.google.com)
2. Create a new property for your application
3. Get your Measurement ID (format: `G-XXXXXXXXXX`)
4. In both `src/index.html` and `src/login.html`, replace **both occurrences** of `G-XXXXXXXXXX` with your actual tracking ID:
- One in the script `src` attribute: `<script async src="https://www.googletagmanager.com/gtag/js?id=YOUR_ID"></script>`
- One in the `gtag('config', 'YOUR_ID')` call
5. Rebuild the frontend with `npm run build`

The Google Analytics tracking code is located in the `<head>` section of both HTML files and will track page views and user interactions automatically.

### Add More Features

- Add more OAuth providers (Twitter, Facebook, etc.)
Expand Down
10 changes: 10 additions & 0 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>WebSocket Chat - Vue.js</title>

<!-- Google Analytics -->
<!-- Replace BOTH occurrences of 'G-XXXXXXXXXX' below with your actual tracking ID from https://analytics.google.com -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXXX"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-XXXXXXXXXX');
</script>
</head>
<body>
<div id="app"></div>
Expand Down
11 changes: 11 additions & 0 deletions src/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Login - WebSocket Game</title>

<!-- Google Analytics -->
<!-- Replace BOTH occurrences of 'G-XXXXXXXXXX' below with your actual tracking ID from https://analytics.google.com -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXXX"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-XXXXXXXXXX');
</script>

<style>
* {
margin: 0;
Expand Down