Adding Google Ads to Your Website
Google Ads uses the following two variables. See Google AdSense for the values:
ini
VITE_GOOGLE_AD_CLIENT=ca-pub-123456
VITE_GOOGLE_AD_SLOT=123456Ads are not loaded when either variable is empty. See Frontend Variables for their types and defaults.
CLI Deployment
Add both variables to frontend/.env.prod, then rebuild and deploy:
bash
pnpm build --emptyOutDir
# For first deployment, you'll be prompted to create a project, fill in production for the production branch
pnpm run deploySee CLI Frontend Deployment for the complete steps.
GitHub Actions Deployment
Add both variables to the existing FRONTEND_ENV secret, then run the Deploy Frontend workflow again.
See GitHub Actions Deployment for the complete steps.
Manual ZIP Deployment
Edit app-config in the archive's index.html and use the field names without the VITE_ prefix:
html
<script id="app-config" type="application/json">
{
"GOOGLE_AD_CLIENT": "ca-pub-123456",
"GOOGLE_AD_SLOT": "123456"
}
</script>See Manual ZIP Deployment for the complete steps.