Skip to main content

Aghanim-Google Analytics for Firebase Integration

This guide explains how to integrate Aghanim with Google Analytics for Firebase to track purchase events and user behavior. By connecting Aghanim with Google Analytics for Firebase, you can monitor player-generated purchase events from the game hub, ensuring comprehensive tracking of user transactions across your game environment.

info

Aghanim currently sends purchase events to Google Analytics for Firebase only when a player successfully completes a payment on the game hub.

Requirements

Step 1: Get your Measurement ID

First, you need to retrieve your Google Analytics 4 Measurement ID:

  1. Log in to your Google Analytics dashboard.
  2. Navigate to AdminData Streams → select your app's data stream.
  3. In the Data stream details, find your Measurement ID (format: G-XXXXXXXXXX).
  4. Copy this Measurement ID - you'll need it for the plugin configuration.

Step 2: Create API Secrets

To enable server-to-server event tracking, you need to create API secrets for the Measurement Protocol. You can create separate API secrets for different platforms (iOS, Android) or use a single generic secret for all platforms.

  1. In the same Data stream details page from Step 1.
  2. Scroll down to Measurement Protocol API secrets and click Create.
  3. Provide a nickname for the API secret (e.g., "Aghanim Integration - Generic" or "Aghanim Integration - iOS") and click Create.
  4. Copy the generated API Secret value - this is a unique string that authenticates your server-to-server requests.
  5. If you want to use different API secrets for different platforms, repeat steps 2-4 for each platform.

For more details, see the Google Analytics Measurement Protocol documentation.

Step 3: Configure the plugin in Aghanim Dashboard

  1. Go to Aghanim Dashboard → Aghanim ConnectGoogle Analytics for Firebase and install the plugin.
  2. In the plugin settings, provide your credentials. You can configure:
    • Generic (applies to all platforms): Measurement ID and API Secret
    • iOS-specific: Measurement ID and API Secret for iOS
    • Android-specific: Measurement ID and API Secret for Android

At least one complete configuration (Measurement ID + API Secret) is required. Platform-specific values override generic ones when both are provided.

How it works

When a player completes a purchase on the game hub, Aghanim automatically sends a purchase event to Google Analytics for Firebase with the following data:

  • client_id: Unique client identifier obtained from the game hub or checkout page
  • user_id: Set to the player's player_id for consistent user identification
  • timestamp_micros: Purchase timestamp in microseconds
  • Event data:
    • Event name: purchase
    • Currency: Order currency (e.g., USD)
    • Value: Purchase amount
    • Transaction ID: Unique order identifier
    • Items: List of purchased items with their IDs and names

This integration ensures that all purchase events from your game hub are automatically tracked in Google Analytics for Firebase, providing you with comprehensive insights into player spending behavior and purchase patterns.

Need help?
Contact our integration team at integration@aghanim.com