To track Google Ads Search Campaigns and get keyword-level data in Branch.io, follow these steps:
1️⃣ Enable Auto-Tagging in Google Ads
Google Ads automatically appends a GCLID (Google Click Identifier) to each ad click when auto-tagging is enabled. This is crucial for tracking keywords in Branch.
✅ Steps to Enable Auto-Tagging:
- Go to Google Ads → Click on Settings.
- Navigate to Account Settings.
- Find Auto-tagging and enable it.
- This ensures Google adds a GCLID to all ad clicks.
2️⃣ Pass GCLID to Branch for Attribution
Branch cannot directly track Google Search keywords, but you can capture GCLID and pass it to Branch.
✅ Steps to Pass GCLID in Branch Links:
- Modify your Google Ads final URL:
ruby
https://yourdomain.com/?gclid={gclid}&keyword={keyword}
- In your app, modify the Branch deep link handler to capture and store GCLID & keyword when the user lands on your page.
Code to Capture GCLID in Web-to-App Journeys
// Extract GCLID & Keyword from URL Parameters
function getQueryParam(param) {
var urlParams = new URLSearchParams(window.location.search);
return urlParams.get(param);
}
var gclid = getQueryParam("gclid");
var keyword = getQueryParam("keyword");
// Send this data to Branch
Branch.setIdentity("user_id", {
gclid: gclid,
keyword: keyword
});
3️⃣ Track Keywords in Branch Dashboard
Since Google doesn’t directly share keyword-level data, you can store the keyword as metadata and track it in Branch reports.
✅ How to View Keyword-Level Data in Branch?
- Go to Branch Dashboard → Data Feeds → Export Events.
- Filter by metadata containing keywords.
- Use Branch Webhooks to send this data to a Google Sheets or CRM.
4️⃣ Sync Keyword Data with Google Ads Offline Conversions
To optimize Google Ads for high-value depositors, send offline conversions back to Google.
✅ Steps to Upload Conversion Data to Google Ads
- Export Branch First Deposit Event with the stored GCLID.
- Format Data in Google’s Offline Conversion Format (CSV).
- Upload it to Google Ads under Conversions → Upload Offline Data.
- This helps Google Ads optimize for keywords that bring high-quality players.
5️⃣ Automate Google Ads + Branch Integration via API
If you need real-time data sync, use:
- Google Ads API to fetch keyword-level data.
- Branch Webhooks to send conversion data back.
Integrating Google Ads API with Branch.io to Track Keyword-Level Data
To track Google Ads keyword-level data in Branch.io, we need to:
✅ Fetch keyword data using the Google Ads API.
✅ Send conversion data back to Google Ads for campaign optimization.
✅ Integrate it with Branch.io for deeper insights.
1️⃣ Get Access to Google Ads API
Step 1: Create a Google Cloud Project
- Go to Google Cloud Console.
- Create a new project.
- Enable Google Ads API (
googleads.googleapis.com
). - Set up OAuth 2.0 credentials (for authentication).
Step 2: Get a Developer Token
- Sign in to Google Ads API Center.
- Request a Developer Token.
- If it’s pending approval, you can use test accounts.
Step 3: Link Google Ads Account & Get Customer ID
- In Google Ads, go to Tools & Settings → Linked Accounts.
- Find your Google Ads Customer ID.
- Link your Google Ads account to your Google Cloud Project.
2️⃣ Fetch Keyword-Level Data using Google Ads API
We use Google Ads API to get keyword-level performance metrics.
Install Google Ads API Library
For Python, install the Google Ads SDK:
pip install google-ads
Python Code to Fetch Keyword-Level Data
from google.ads.google_ads.client import GoogleAdsClient
# Load Google Ads API credentials (from google-ads.yaml file)
client = GoogleAdsClient.load_from_storage()
# Your Google Ads Account ID
customer_id = "123-456-7890"
# Query to fetch keyword performance
query = """
SELECT
campaign.id,
ad_group.id,
keyword_view.keyword.text,
metrics.clicks,
metrics.conversions
FROM keyword_view
WHERE segments.date DURING LAST_7_DAYS
"""
# Execute query
response = client.service.google_ads.search(customer_id=customer_id, query=query)
# Print keyword-level data
for row in response:
print(f"Keyword: {row.keyword_view.keyword.text}, Clicks: {row.metrics.clicks}, Conversions: {row.metrics.conversions}")
✅ This script fetches:
- Keyword text
- Clicks
- Conversions
You can store this data in a Google Sheet, CRM, or Branch.io metadata.
3️⃣ Send Conversion Data from Branch.io to Google Ads
After tracking first deposit events in Branch.io, we need to send conversion data to Google Ads.
Step 1: Export First Deposit Data from Branch.io
- Go to Branch Dashboard → Data Feeds → Export Events.
- Download data with
gclid
andconversion_value
.
Step 2: Format Data for Google Ads Upload
Google Ads expects offline conversion uploads in this format:
GCLID | Conversion Name | Conversion Time | Conversion Value |
---|---|---|---|
123ABC | First_Deposit | 2024-03-17 12:30:00 | 100 |
456DEF | First_Deposit | 2024-03-17 14:00:00 | 50 |
Step 3: Upload Data via Google Ads API
from google.ads.google_ads.client import GoogleAdsClient
import datetime
# Load Google Ads API client
client = GoogleAdsClient.load_from_storage()
# Google Ads Customer ID
customer_id = "123-456-7890"
# Conversion action ID (Get this from Google Ads → Conversions)
conversion_action_id = "123456789"
# Conversion Data
conversion_data = [
{
"gclid": "123ABC",
"conversion_action": f"customers/{customer_id}/conversionActions/{conversion_action_id}",
"conversion_value": 100,
"conversion_date_time": datetime.datetime.utcnow().isoformat() + "Z"
}
]
# Create conversion upload request
conversion_upload_service = client.get_service("ConversionUploadService")
response = conversion_upload_service.upload_click_conversions(
customer_id=customer_id,
conversions=conversion_data,
partial_failure=True,
)
# Print response
print("Uploaded conversions:", response)
✅ This script:
✔ Uploads GCLID-based conversions to Google Ads.
✔ Helps Google optimize for high-value depositors.
4️⃣ Automate the Process
- Daily Sync: Use a CRON job to fetch keyword data and upload conversions.
- Google Sheets Integration: Use a Google Apps Script to auto-upload conversions.
5️⃣ Benefits of This Setup
🚀 Get keyword-level insights in Branch.io.
📊 Optimize Google Ads for high-value users.
🔄 Automate conversion tracking for better campaign performance.