Search code examples
google-ads-apigoogle-ad-manager

How to find GCLID [Google Click Identifier] with the help of campaign_id using google ads api


I tried to fetch GCLID using campaign_id but I'm not able to find it.

I've explore over a network but can't find any way to find GCLID.

Currently I've such type of data :-

{
            "campaign": {
                "resourceName": "customers/{customer_id}/campaigns/{campaign_id}",
                "status": "ENABLED",
                "name": "campaign_name"
            },
            "ad_account": "ad_account_id"
        }

I want GCLID with the help of any of above fields

Or informed me if there any other fields required to get GCLID.

Actual Requirement :-I'm storing leads which is comes through google ads , in that data I've store GCLID from URL parameters of the landing page where the user lands after clicking on the ad.

Lead store such like this in my Database :-

{
  "_id": "652d453sd46453f45"
  "lead_id": "652a2bd489a65bf1ad53618a",
  "url_parameters": {
    "tactic_id": "5907417",
    "utm_source": "google-adwords",
    "utm_medium": "Campaign_medium",
    "utm_campaign": "Campaign_Name",
    "utm_term": "TERM",
    "device": "c",
    "matchtype": "p",
    "network": "g",
    "gclid": "GCLID",
    "gad": "1/lead"
  },
  "current_url": "URL/?tactic_id=5907417&utm_source=google-adwords&utm_medium=[Campaign_medium]&utm_campaign=[Campaign_Name]&utm_term=customer%20management%20tools&device=c&matchtype=p&network=g&gclid=[GCLID]&gad=1/contact",
}

So I'm displaying campaign impressions, clicks , etc.. so here i want to show how many leads come through this campaign, so for this campaign first i've to find GCLID and then I'll fetch leads which is attributed in my DATABASE with the help of using this GCLID.


Solution

  • There isn't any way to get campaign detail using gclid , but you can add campaign detail in tracking template.

    Steps to add tracking template in google ad :-

    1. Login to google ads
    2. Click on admin setting icon -> Account setting -> Tracking -> update tracking template as per your requirement
    3. You can add campaignid={campaignid} in tracking template to get campaignid for better lead tracking.