How to Send Indoleads Conversions to Google Ads Automatically

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

  1. Turn on auto-tagging: Settings → Account settings → Auto-tagging → ON.

  2. Create a conversion action: Goals → Conversions → New → Import → Track conversions from clicks (GCLID). Name it Indoleads. Save and note the Conversion Action ID.

  3. Note your Customer ID (10 digits, no dashes).

  4. 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_URL
  • Do not URL-encode the braces (%7B…%7D will 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

Field

Token

Purpose

gclid

{p1}

Google click id

payout

{payout_usd}

conversion value (USD)

time

{conversion_datetime}

conversion time

txn

{txn_id}

de-duplication key

status

{status}

only approved is uploaded


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

  1. Test click → in the Indoleads report, p1 should contain a long Cj0KCQ… string. Empty or {gclid} means Step 2 is broken.

  2. Approve a lead → your server log (error_log) should show a Google response with no errors.

  3. Conversions appear in Google Ads with a delay of a few hours.


Troubleshooting

Symptom

Fix

Symptom

Fix

p1 empty / {gclid}

Enable auto-tagging; don't encode the braces

GCLID_NOT_FOUND

Conversion arrived after the attribution window — widen the conversion window

UNAUTHENTICATED

Refresh the OAuth refresh token / developer token

Too many conversions

You are sending pending — check the approved filter

Duplicate conversions

Ensure {txn_id} is passed (the lock relies on it)


Once configured, every approved Indoleads lead is uploaded to your Google Ads automatically, matched to the real click.