## Google Ads Integration Troubleshooting

Having issues with your Google Ads integration? This guide covers common problems and their solutions to get your Google Ads data syncing correctly.

### Connection Problems

#### "No Google Ads accounts found"

Symptoms: Can't select account during connection

Causes & Solutions:

##### 1. Wrong Google Account

Solution:

1. Sign out of Google completely
2. In Alpha Insights, try connecting again
3. Sign in with the Google account that manages your ads (check Google Ads → Settings → Account access)

##### 2. No Access to Any Ad Accounts

Solution:

- Go to ads.google.com
- Verify you can see at least one ad account
- If not, request access from account owner
- Need at least "Standard" access level

##### 3. Recently Created Account

Issue: Brand new Google Ads accounts may take 24 hours to be API-accessible

Solution: Wait 24 hours after creating account, then try connecting

#### "Permission denied" or "Insufficient access"

Cause: Your account role is too limited

Solution:

1. Go to Google Ads → Tools → Account access
2. Find your email address in the list
3. - Admin - Full access, works perfectly
   - Standard - Can view data, works
   - Read-only - Cannot access API data
   - Email-only - Cannot access API data
4. If Read-only or Email-only, request upgrade from account owner
5. Wait 5 minutes after permission change
6. Try connecting again

#### "OAuth error" or "Authentication failed"

Common causes:

##### 1. Popup Blocked

Solution:

- Look for popup blocker icon in browser address bar
- Allow popups from your site
- Try connecting again

##### 2. Didn't Complete All Permission Screens

Solution:

- Make sure you clicked "Allow" on all Google permission screens
- There may be 2-3 screens - complete all of them

##### 3. Browser Privacy Settings

Solution:

- Try in incognito/private mode
- Or temporarily disable browser extensions (uBlock, Privacy Badger)
- Complete connection
- Can re-enable extensions after

#### "Connection expired" or "Token invalid"

Cause: Google API token expired (happens periodically)

Solution:

1. Go to Settings → Google Ads
2. Click Refresh Token
3. Re-authenticate with Google
4. Connection restored

Note: This is normal and happens to all users eventually. Just refresh when notified.

Technical Details: Refresh tokens are stored in `wpd_ai_google_ads_api_refresh_token` option and access tokens are refreshed automatically via the `api_refresh_access_token()` method using the Google OAuth 2.0 token endpoint.

### Sync Issues

#### Data Not Syncing

Symptoms: Last sync time is old, no new data appearing

Diagnostic steps:

1. Go to Settings → Google Ads
2. Check connection status (should be green "Connected")
3. Check last sync time
4. Click View Sync Logs for error messages

#### If Status Shows "Error" or "Disconnected"

Solution:

1. Click Refresh Token
2. Re-authenticate
3. Click Sync Now

#### If Status is "Connected" But Last Sync is Old

Check WordPress cron:

1. Go to Settings → Performance
2. Check if "WordPress Cron Disabled" warning appears
3. If so, contact your host to enable WP-Cron
4. Or manually trigger: click Sync Now

Technical Details: Syncing is managed by WordPress Action Scheduler. Check scheduled actions with `as_next_scheduled_action('wpd_scheduled_google_ads_sync')`. Sync frequency options: daily, 12-hrs, 6-hrs stored in settings.

#### If Sync Logs Show Errors

Common error messages:

"Rate limit exceeded"

- Reduce sync frequency to "Every 6 hours" or "Daily"
- Wait 1 hour for quota to reset
- Try again

"Invalid customer ID"

- Your ad account may have been closed or suspended
- Check Google Ads directly to verify account is active
- If account changed, disconnect and reconnect

"Report definition error"

- Temporary Google Ads API issue
- Wait 30 minutes and try again
- If persists, contact support

#### Only Some Campaigns Syncing

Symptoms: See some campaigns but others are missing

Causes & Solutions:

##### 1. Campaign Type Filtering

Check: Settings → Google Ads → Campaign Types

1. Verify campaign types are selected (Search, Shopping, Display, etc.)
2. If missing type is unchecked, check it
3. Save and click Sync Now

##### 2. Campaign Status Filtering

By default: Only active and paused campaigns sync

1. Go to Settings → Google Ads
2. Enable "Include ended campaigns" if you want historical data
3. Save and sync

##### 3. Campaign Date Range

Issue: Campaign ran before your historical import range

Example: You imported "Last 30 days" but campaign ran 60 days ago

Solution:

1. Increase historical import range to "Last 90 days" or "Last year"
2. Click Re-import Historical Data
3. Wait for import to complete

##### 4. Manager (MCC) Account Filtering

If using MCC account:

1. Go to Settings → Google Ads → Manage Accounts
2. Verify the client account is selected
3. If not, check it and save

### Slow Syncing

Symptoms: Syncs take 5+ minutes or time out

Causes & Solutions:

##### 1. Large Number of Campaigns

If you have 50+ campaigns:

- Syncing takes longer (normal)
- Consider archiving old ended campaigns in Google Ads
- Or filter to sync only active campaigns

##### 2. Large Historical Import

Importing "All time" with years of data:

- Can take 30-90 minutes for initial import (normal)
- Let it complete in background
- Future syncs will be much faster

##### 3. Shared Hosting Limitations

Low-resource hosting:

- Contact host about increasing PHP execution time
- Or reduce sync frequency to "Daily"
- Consider upgrading hosting if running large store

### Data Accuracy Issues

#### Spend Doesn't Match Google Ads

Common reasons:

##### 1. Currency Mismatch

Check:

1. Settings → Google Ads → Currency
2. Should match your Google Ads account currency
3. If different, change it and re-sync

Technical Details: Currency is automatically detected from `$this->customer_accounts[$this->customer_id]['currencyCode']` via Google Ads API

##### 2. Time Zone Differences

Issue: Google Ads uses account timezone, Alpha Insights uses WordPress timezone

Result: Small discrepancies at day boundaries (1-5% difference)

Solution for exact matching:

1. Go to WordPress → Settings → General
2. Set timezone to match Google Ads account timezone
3. Re-sync data

##### 3. Data Processing Delay

Issue: Google Ads finalizes spend numbers with 2-3 hour delay

Solution:

- Compare yesterday's data, not today's
- Today's spend may not match until evening
- Check again tomorrow - should match once finalized

##### 4. Campaign Filters

Check: You're comparing same campaigns in both systems

- Alpha Insights: Verify which campaign types are included
- Google Ads: Make sure you're viewing same campaign types

##### 5. Date Range Calculation

Issue:"Last 30 days" means different dates depending on when checked

Solution: Use specific date ranges ("Jan 1 - Jan 31") for comparisons

### ROAS Doesn't Match Google Ads

This is expected and normal!

Why they differ:

Aspect | Google Ads | Alpha Insights
--- | --- | ---
Conversions | Includes view-through (saw ad, didn't click) | Click-through only
Attribution | 30-day click, 1-day view default | 7-day click default
Revenue | At time of conversion | WooCommerce order total
Modeling | Uses statistical modeling | Actual orders only

Result: Alpha Insights ROAS is typically 20-40% lower than Google's reported ROAS

Which to trust? Alpha Insights - it shows actual profit based on real orders, not Google's estimates

#### Missing Revenue / Orders

Symptoms: Campaign shows spend but no attributed revenue

Causes & Solutions:

##### 1. Auto-Tagging Not Enabled

Solution:

1. Go to Google Ads → Settings → Account settings
2. Under "Tracking", enable Auto-tagging
3. Click Save
4. Future clicks will be properly tagged with GCLID

This is the most common cause!

Technical Details: GCLID is captured and stored in `_wpd_ai_landing_page` order meta. The method `get_gclid_from_landing_page()` extracts GCLID from landing page URLs for attribution.

##### 2. UTM Parameters Missing

If not using auto-tagging, you need UTM parameters:

    	?utm_source=google&utm_medium=cpc&utm_campaign={campaignid}

Or better yet, use Alpha Insights' recommended parameter:

    	?google_cid={campaignid}

Add these to your destination URLs in Google Ads

Technical Details: The UTM tracking key `google_cid` is defined in the API class and used by `set_order_campaign_id_via_query_param()` to match orders to campaigns.

##### 3. Attribution Window Too Short

Issue: Customers clicking ads but converting outside window

Solution:

1. Go to Settings → Google Ads → Attribution Window
2. Increase from 7 days to 14 or 28 days
3. Especially important for high-consideration products

##### 4. Orders Before Connection

Issue: Can't attribute orders that happened before integration was connected

This is expected: Attribution only works going forward from connection date

##### 5. Traffic Source Not Detected

Possible reasons:

- Customer used different device/browser
- Cookies were blocked/cleared
- Used incognito mode
- Long time between click and purchase

This is normal: Some attribution loss (10-20%) is expected

### Campaign Display Issues

#### Campaign Names Are Wrong or Garbled

Cause: Character encoding issue or sync glitch

Solution:

1. Click Sync Now to refresh campaign names
2. If still wrong, disconnect and reconnect integration

#### Duplicate Campaigns Showing

Cause: Campaign was reconnected or imported twice

Solution:

1. Go to Google Ads Campaigns list
2. Identify duplicate (check campaign IDs - duplicates have same ID)
3. Delete the duplicate entry

Technical Details: Campaign IDs are stored in post meta `_wpd_campaign_id`. Each campaign should have a unique ID from Google Ads API.

#### Deleted Campaign Still Appears

This is intentional! Historical data is preserved even if campaign deleted in Google Ads

To hide:

- Filter campaign list to show "Active only"
- Or manually archive the campaign in Alpha Insights

### Manager (MCC) Account Issues

#### Can't See Client Accounts

Solution:

1. Verify you connected with Manager account credentials
2. Check you have manager access in Google Ads MCC
3. Refresh connection and select Manager account specifically

#### Some Client Accounts Missing

Check:

1. Settings → Google Ads → Manage Accounts
2. Verify client accounts are selected
3. If not listed, may not have API access enabled
4. Enable API access in Google Ads MCC for that client

#### API and Technical Errors

#### "API Rate Limit Exceeded"

Cause: Too many API requests

Google Ads limits:15,000 operations per day per account

Solutions:

- Reduce sync frequency to "Daily"
- Reduce number of campaigns being synced
- If using multiple tools accessing Google Ads API, coordinate usage
- Wait 24 hours for quota to reset

#### "Internal Error" or "Unknown Error"

Cause: Temporary Google Ads API issue

Solution:

- Wait 30 minutes and try again
- Check Google Ads API blog for service issues
- If persists beyond 2 hours, contact support

Technical Details: Alpha Insights uses Google Ads API v20. API errors are logged in `WPDAI_Google_Ads_API_error_log` option for debugging.

#### "Customer not found" or "Invalid customer ID"

Causes:

- Google Ads account was closed or suspended
- Account ID changed (rare)
- Lost access to account

Solution:

1. Verify account still exists in Google Ads
2. Check account status is active
3. If account changed, disconnect and reconnect with new account

### Getting Additional Help

#### Before Contacting Support

Collect this information:

- Screenshot of error message
- Connection status from Settings → Google Ads
- Recent sync log entries
- Google Ads customer ID (format: 123-456-7890)
- When issue started
- What you've tried already

#### Enable Debug Logging

1. Go to Settings → General → Advanced
2. Enable Debug Mode
3. Try the failing action again
4. Go to Settings → Logs
5. Copy relevant log entries

#### Check API Status

Verify Google Ads API is operational:

- Google Ads API Blog
- Google Cloud Status

#### Contact Support

Open a support ticket with:

- Description of issue
- Steps to reproduce
- Screenshots
- Debug logs
- Google Ads customer ID

We typically respond within 24 hours!

#### Prevention Tips

- Enable auto-tagging in Google Ads
- Keep WordPress and Alpha Insights updated
- Don't change Google Ads account access frequently
- Monitor sync status weekly
- Refresh token proactively if you see "expires soon" warning

#### Technical Implementation Notes

For developers and advanced troubleshooting:

- API Class: `WPDAI_Google_Ads_API` located in `includes/classes/WPDAI_Google_Ads_API.php`
- API Version: Google Ads API v20
- Authentication: OAuth 2.0 with refresh tokens stored in `wpd_ai_google_ads_api_refresh_token`
- Campaign Storage: Custom post type `google_ad_campaign` with taxonomy `ad_account`
- Data Syncing: Managed by WordPress Action Scheduler
- API Queries: Uses Google Ads Query Language (GAQL) to fetch campaign metrics
- Error Logging: Errors stored in `WPDAI_Google_Ads_API_error_log` and `WPDAI_Google_Ads_API_log` options
- GCLID Capture: Landing pages stored in `_wpd_ai_landing_page` order meta
- Campaign Attribution: Methods `set_order_campaign_id_via_query_param()` and `api_fetch_campaign_id_by_gclid()`
- Conversion Actions: Can create profit and add-to-cart conversion actions via `api_create_profit_conversion_action()` and `api_create_add_to_cart_conversion_action()`