How to Send Indoleads Conversions to Google Ads Automatically
This guide explains how to make approved conversions from Indoleads appear in your Google Ads account.
How it works
Google tags every ad click with a gclid. We carry that gclid through the tracking link, and when your lead is approved, Indoleads fires a postback to your server. Your script uploads the conversion (with the gclid) back to Google Ads via the API, and Google matches it to the original click.
Google Ads ──gclid──▶ tracking link ──▶ offer ──▶ approved
│ postback
your post_url.php ──API──▶ Google Ads ✅Note: Google Ads has no direct "postback" endpoint. Offline conversions can only enter Google Ads by uploading them against the
gclid. That is what the script below does.
Step 1 — Prepare Google Ads
Turn on auto-tagging: Settings → Account settings → Auto-tagging → ON.
Create a conversion action: Goals → Conversions → New → Import → Track conversions from clicks (GCLID). Name it
Indoleads. Save and note the Conversion Action ID.Note your Customer ID (10 digits, no dashes).
Get API access (one time):
Developer token — Google Ads → API Center.
OAuth client_id / client_secret — Google Cloud Console.
Refresh token — OAuth Playground, scope
<https://www.googleapis.com/auth/adwords.>
Step 2 — Tracking link: carry the gclid in p1
There is no {gclid} token in the postback, so we store the gclid in slot p1. Add p1={gclid} to your tracking link:
https://trk.oneklix.com/YOUR_ID?gclid={gclid}&p1={gclid}&force_transparent=true&redirection_url=YOUR_OFFER_URLDo not URL-encode the braces (
%7B…%7Dwill not be replaced by Google).Use this link as the Final URL of your ad.
Step 3 — Configure the postback in Indoleads
In the Postback URL field, enter your script URL with tokens:
https://YOUR-DOMAIN/post_url.php?gclid={p1}&payout={payout_usd}&time={conversion_datetime}&txn={txn_id}&status={status}By events → "Create and status update" (required — otherwise the approval event is never sent).
Click Test, then Save.
Field | Token | Purpose |
|---|---|---|
gclid |
| Google click id |
payout |
| conversion value (USD) |
time |
| conversion time |
txn |
| de-duplication key |
status |
| only |
Step 4 — Deploy post_url.php on your server
Fill in your values and upload the file to any PHP host.
<?php
$CUSTOMER_ID = '1234567890';
$ACTION_ID = '456789';
$DEVELOPER_TOKEN = 'XXXX';
$CLIENT_ID = 'xxxx.apps.googleusercontent.com';
$CLIENT_SECRET = 'xxxx';
$REFRESH_TOKEN = 'xxxx';
$API_VERSION = 'v21'; // check the current Google Ads API version
$gclid = $_GET['gclid'] ?? '';
$payout = $_GET['payout'] ?? '0';
$status = $_GET['status'] ?? '';
$txn = $_GET['txn'] ?? '';
// upload only approved conversions with a valid gclid
if ($status !== 'approved' || $gclid === '' || $gclid === '{gclid}') { exit('skip'); }
// de-duplication by txn_id
$lock = sys_get_temp_dir()."/gads_$txn.lock";
if ($txn && file_exists($lock)) { exit('dup'); }
if ($txn) @touch($lock);
// refresh the access token
$tok = json_decode(http_post('https://oauth2.googleapis.com/token', http_build_query([
'client_id'=>$CLIENT_ID,'client_secret'=>$CLIENT_SECRET,
'refresh_token'=>$REFRESH_TOKEN,'grant_type'=>'refresh_token',
]), ['Content-Type: application/x-www-form-urlencoded']), true);
$access = $tok['access_token'] ?? ''; if (!$access) { exit('no token'); }
// upload the conversion
$body = json_encode(['conversions'=>[[
'gclid'=>$gclid,
'conversionAction'=>"customers/$CUSTOMER_ID/conversionActions/$ACTION_ID",
'conversionDateTime'=>gmdate('Y-m-d H:i:s').'+00:00',
'conversionValue'=>(float)$payout,
'currencyCode'=>'USD',
]],'partialFailure'=>true]);
$r = http_post("https://googleads.googleapis.com/$API_VERSION/customers/$CUSTOMER_ID:uploadClickConversions",
$body, ["Authorization: Bearer $access","developer-token: $DEVELOPER_TOKEN","Content-Type: application/json"]);
error_log("GAds: $r"); echo 'ok';
function http_post($u,$d,$h){$c=curl_init($u);curl_setopt_array($c,[CURLOPT_POST=>1,
CURLOPT_POSTFIELDS=>$d,CURLOPT_HTTPHEADER=>$h,CURLOPT_RETURNTRANSFER=>1,CURLOPT_TIMEOUT=>15]);
$r=curl_exec($c);curl_close($c);return $r;}Manager (MCC) account? Add the header
login-customer-id: <manager_id_without_dashes>.
Step 5 — Verify
Test click → in the Indoleads report,
p1should contain a longCj0KCQ…string. Empty or{gclid}means Step 2 is broken.Approve a lead → your server log (
error_log) should show a Google response with no errors.Conversions appear in Google Ads with a delay of a few hours.
Troubleshooting
Symptom | Fix |
|---|---|
| Enable auto-tagging; don't encode the braces |
| Conversion arrived after the attribution window — widen the conversion window |
| Refresh the OAuth refresh token / developer token |
Too many conversions | You are sending |
Duplicate conversions | Ensure |
Once configured, every approved Indoleads lead is uploaded to your Google Ads automatically, matched to the real click.