Google Analytics

Google Analytics is a powerful web analytics service that helps you track website traffic and user behavior. With the Forge Apps system, you can easily add Google Analytics to your site without manually editing code.

Forge App: This integration is part of the Forge Apps system, which automatically injects the necessary code into your site during deployment.

What is Google Analytics?

Google Analytics provides detailed insights about your website visitors, including:

  • Traffic Sources: How visitors find your site (search engines, social media, direct links)
  • User Behavior: Which pages are most popular, how long visitors stay
  • Audience Demographics: Geographic location, device types, browsers
  • Conversion Tracking: Monitor goals and e-commerce transactions
  • Real-time Data: See current visitors and their activity

Installation

Installing Google Analytics on your Forge site is simple:

1. Access the App Marketplace

Navigate to your site's dashboard and click on the "Apps" section in the sidebar.

2. Find Google Analytics

Browse the available apps or search for "Google Analytics" in the marketplace.

3. Install the App

Click the "Install" button next to Google Analytics. The app will be added to your site immediately.

4. Configure Your Tracking ID

After installation, you'll need to provide your Google Analytics Tracking ID to start collecting data.

5. Deploy Your Site

Important: After configuring the app, you must deploy your site for the Google Analytics code to be injected. The code injection happens during the pre-deploy process.

Getting Your Google Analytics Tracking ID

Before configuring the app, you'll need to set up a Google Analytics property and get your tracking ID:

1. Create a Google Analytics Account

  1. Go to Google Analytics
  2. Click "Start measuring" or sign in to your existing account
  3. Follow the setup wizard to create a new account

2. Create a Property

  1. In your Google Analytics account, click "Create Property"
  2. Enter your website name and URL
  3. Select your industry category and timezone
  4. Click "Next" to proceed

3. Get Your Tracking ID

  1. After creating the property, you'll see a tracking ID
  2. It will look like: UA-XXXXXXXXX-X or G-XXXXXXXXXX
  3. Copy this tracking ID - you'll need it for the Forge App configuration

Configuration

Once you have your tracking ID, configure the Google Analytics app:

Required Settings

Tracking ID

Enter your Google Analytics tracking ID (e.g., UA-12345678-9 or G-XXXXXXXXXX).

Note: Make sure to use the correct tracking ID format. Universal Analytics uses UA-XXXXXXXXX-X format, while Google Analytics 4 uses G-XXXXXXXXXX format.

Optional Settings

Enhanced Link Attribution

Enable this to get more detailed information about which links users click on your site.

Demographics and Interest Reports

Enable this to collect demographic and interest data about your visitors.

Enhanced Ecommerce

Enable this if you have an e-commerce site to track product performance and sales data.

How It Works

The Google Analytics Forge App automatically injects the necessary tracking code into your site's HTML during deployment. Here's what happens:

Deployment Required: Code injection only occurs when you deploy your site. After configuring the app, you must deploy for the tracking code to be added to your pages.

1. Code Injection

The app adds the Google Analytics tracking code to the <head> section of your HTML pages.

2. Automatic Tracking

Once deployed, the tracking code automatically begins collecting visitor data and sending it to your Google Analytics account.

3. Real-time Updates

Data appears in your Google Analytics dashboard within a few hours, with real-time data available immediately.

Verifying Installation

After configuring the app, verify that Google Analytics is working correctly:

1. Check Your Site

Visit your website and open the browser's developer tools. Look for Google Analytics requests in the Network tab.

2. Check Google Analytics

In your Google Analytics dashboard, go to "Real-time" → "Overview" to see if your visit is being tracked.

3. Use Google Analytics Debugger

Install the Google Analytics Debugger browser extension to see detailed tracking information.

Common Issues

No Data Appearing

Possible causes:

  • Incorrect tracking ID format
  • Site not yet deployed after configuration
  • Ad blockers preventing tracking
  • Wrong Google Analytics property selected

Solutions:

  • Double-check your tracking ID format
  • Deploy your site to apply changes
  • Test with ad blockers disabled
  • Verify you're looking at the correct Google Analytics property

Duplicate Tracking

Problem: You already have Google Analytics code manually added to your site.

Solution: Remove any existing Google Analytics code from your HTML files to avoid duplicate tracking.

Wrong Tracking ID

Problem: You're using a tracking ID from the wrong Google Analytics property.

Solution: Create a new property in Google Analytics or use the correct tracking ID for your site.

Best Practices

Privacy Compliance

Ensure your privacy policy mentions Google Analytics tracking and consider implementing cookie consent if required by your jurisdiction.

Regular Monitoring

Check your Google Analytics dashboard regularly to monitor site performance and identify areas for improvement.

Goal Setting

Set up goals in Google Analytics to track important actions like form submissions, downloads, or purchases.

Data Retention

Configure data retention settings in Google Analytics to comply with privacy regulations and manage storage costs.

Updating Configuration

To update your Google Analytics configuration:

  1. Go to your site's Apps section
  2. Find Google Analytics in your installed apps
  3. Click "Configure" to modify settings
  4. Save your changes
  5. Deploy your site to apply the updates (required for code injection)

Uninstalling

To remove Google Analytics from your site:

  1. Go to your site's Apps section
  2. Find Google Analytics in your installed apps
  3. Click "Uninstall" to remove the app
  4. Deploy your site to remove the tracking code
Note: Uninstalling the app will remove the tracking code from your site, but your Google Analytics account and historical data will remain intact.

Need Help?

If you encounter issues with Google Analytics:

  • Check the Google Analytics Help Center
  • Verify your tracking ID format and property settings
  • Test with browser developer tools to see tracking requests
  • Contact Forge support if the app isn't working as expected

Join the Discussion

Have questions or want to share your experience? Join our community discussion to connect with other developers and get help from the Forge team.

Visit Forum Discussion