ProfitGuard AI is designed to run in two modes:
- Simulation Mode: Uses mock data (Default for public demo).
- Live API Mode: Connects to real Google Ads accounts.
To enable Live Mode, you must configure your Google Cloud credentials.
- A Google Ads Manager Account (MCC).
- A Google Cloud Console Project with the "Google Ads API" enabled.
- Developer Token (Basic Access is sufficient).
- Go to Google Cloud Console.
- Create OAuth 2.0 Client IDs (Application Type: Web Application).
- Add
http://localhost:3000/oauth2callbackto Authorized Redirect URIs. - Download your
Client IDandClient Secret.
We have included a utility script to help you generate the necessary Refresh Token.
- Open
scripts/getRefreshToken.jsand input yourCLIENT_IDandCLIENT_SECRET. - Run the script locally:
node scripts/getRefreshToken.js
- Follow the console prompts to authenticate via your browser.
- Copy the generated Refresh Token.
Create a .env file in the root directory (do not commit this file):
VITE_GOOGLE_ADS_CLIENT_ID=your_client_id_here
VITE_GOOGLE_ADS_CLIENT_SECRET=your_client_secret_here
VITE_GOOGLE_ADS_DEVELOPER_TOKEN=your_developer_token_here
VITE_GOOGLE_ADS_REFRESH_TOKEN=your_generated_refresh_token_here
VITE_GOOGLE_ADS_CUSTOMER_ID=your_target_customer_idBy default, ProfitGuard ships in Simulation Mode so the UI works immediately without credentials.
To switch to Live API Mode:
- Open the file
services/adsService.ts. - Locate the configuration flag at the top of the file.
- Change
USE_LIVE_APIfromfalsetotrue.
// services/adsService.ts
// CHANGE THIS TO TRUE TO ENABLE REAL DATA
export const USE_LIVE_API = true;-
Note: If you revert this to false, the app will seamlessly fallback to using the mock data generator for demonstration purposes.
-
Security Note: Never commit your .env file or hardcode API tokens in public repositories.