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.
Aghanim currently sends purchase events to Google Analytics for Firebase only when a player successfully completes a payment on the game hub.
Requirements
- Google Analytics for Firebase account
- Firebase project with Analytics enabled
- Administrative permissions to access Measurement Protocol settings
Step 1: Get your Measurement ID
First, you need to retrieve your Google Analytics 4 Measurement ID:
- Log in to your Google Analytics dashboard.
- Navigate to Admin → Data Streams → select your app's data stream.
- In the Data stream details, find your Measurement ID (format:
G-XXXXXXXXXX). - 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.
- In the same Data stream details page from Step 1.
- Scroll down to Measurement Protocol API secrets and click Create.
- Provide a nickname for the API secret (e.g., "Aghanim Integration - Generic" or "Aghanim Integration - iOS") and click Create.
- Copy the generated API Secret value - this is a unique string that authenticates your server-to-server requests.
- 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
- Go to Aghanim Dashboard → Aghanim Connect → Google Analytics for Firebase and install the plugin.
- 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_idfor 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
- Event name:
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