Get Google Shopping Sellers Ad URL

 
Google Shopping Sellers Ad URL is designed to provide you with a full URL of the advertisement containing all additional parameters set by the seller.

checked GET
Pricing

Your account will be charged for each request.
The cost can be calculated on the Pricing page.

Description of the fields for sending a request:

Field nameTypeDescription
shop_ad_aclkstring

unique ad click referral parameter
you can obtain this parameter with Google Shopping Products or Google Shopping Sellers


‌‌‌‌
‌‌As a response of the API server, you will receive JSON-encoded data containing a tasks array with the information specific to the set tasks.

Description of the fields in the results array:

Field nameTypeDescription
versionstring

the current version of the API

status_codeinteger

general status code
you can find the full list of the response codes here
Note: we strongly recommend designing a necessary system for handling related exceptional or error conditions

status_messagestring

general informational message
you can find the full list of general informational messages here

timestring

execution time, seconds

costfloat

total tasks cost, USD

tasks_countinteger

the number of tasks in the tasks array

tasks_errorinteger

the number of tasks in the tasks array that were returned an error

tasksarray

array of tasks

    idstring

task identifier
unique task identifier in our system in the UUID format

    status_codeinteger

status code of the task
generated by DataForSEO; can be within the following range: 10000-60000
you can find the full list of the response codes here

    status_messagestring

informational message of the task
you can find the full list of general informational messages here

    timestring

execution time, seconds

    costfloat

cost of the task, USD

    result_countinteger

number of elements in the result array

    patharray

URL path of the GET request

    dataobject

contains the same parameters that you specified in the POST request

    resultarray

array of results

        ad_aclkstring

unique ad click referral parameter

        ad_urlstring

full URL of the advertisement

        ad_url_redirectsarray

URLs where the link from Google Shopping redirects before reaching a final URL
includes up to 10 URLs of the ad's redirect path to the seller's ad_url


‌‌

Instead of ‘login’ and ‘password’ use your credentials from https://app.dataforseo.com/api-access

# Instead of 'login' and 'password' use your credentials from https://app.dataforseo.com/api-access 
login="login" 
password="password" 
cred="$(printf ${login}:${password} | base64)" 
curl --location --request GET "https://api.dataforseo.com/v3/merchant/google/sellers/ad_url/DChcSEwiSl5TKpbPoAhVFmdUKHfa_B_wYABADGgJ3cw&sig" 
--header "Authorization: Basic ${cred}"  
--header "Content-Type: application/json" 
--data-raw ""
<?php
// You can download this file from here https://cdn.dataforseo.com/v3/examples/php/php_RestClient.zip
require('RestClient.php');
$api_url = 'https://api.dataforseo.com/';
// Instead of 'login' and 'password' use your credentials from https://app.dataforseo.com/api-access
$client = new RestClient($api_url, null, 'login', 'password');

try {
   // get ad_url by the ad_aclk
   // GET /v3/merchant/google/sellers/ad_url/$ad_aclk
   // use the ad_aclk that you received upon a sellers task
   $ad_aclk = "DChcSEwj2qKzGv_rrAhWXIK0GHbB0BQEYABAHGgJwdg";
   $result = $client->get('/v3/merchant/google/sellers/ad_url/' . $ad_aclk);
   print_r($result);
   // do something with result
} catch (RestClientException $e) {
   echo "n";
   print "HTTP code: {$e->getHttpCode()}n";
   print "Error code: {$e->getCode()}n";
   print "Message: {$e->getMessage()}n";
   print  $e->getTraceAsString();
   echo "n";
}
$client = null;
?>
var task_id = 'DChcSEwj2qKzGv_rrAhWXIK0GHbB0BQEYABAHGgJwdg';

const axios = require('axios');

axios({
    method: 'get',
    url: 'https://api.dataforseo.com/v3/merchant/google/sellers/ad_url/' + task_id,
    auth: {
        username: 'login',
        password: 'password'
    },
    headers: {
        'content-type': 'application/json'
    }
}).then(function (response) {
    var result = response['data']['tasks'][0]['result'];
    // Result data
    console.log(result);
}).catch(function (error) {
    console.log(error);
});
from client import RestClient
# You can download this file from here https://cdn.dataforseo.com/v3/examples/python/python_Client.zip
client = RestClient("login", "password")
# get ad_url by the ad_aclk
# GET /v3/merchant/google/sellers/ad_url/$ad_aclk
# use the ad_aclk that you received upon a sellers task
ad_aclk = "DChcSEwiSl5TKpbPoAhVFmdUKHfa_B_wYABADGgJ3cw&sig"
response = client.get("/v3/merchant/google/sellers/ad_url/" + ad_aclk)
# you can find the full list of the response codes here https://docs.dataforseo.com/v3/appendix/errors
if response["status_code"] == 20000:
    print(response)
    # do something with result
else:
    print("error. Code: %d Message: %s" % (response["status_code"], response["status_message"]))
using Newtonsoft.Json;
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;

namespace DataForSeoDemos
{
    public static partial class Demos
    {
        public static async Task merchant_google_sellers_ad_url()
        {
            var httpClient = new HttpClient
            {
                BaseAddress = new Uri("https://api.dataforseo.com/"),
                // Instead of 'login' and 'password' use your credentials from https://app.dataforseo.com/api-access
                DefaultRequestHeaders = { Authorization = new AuthenticationHeaderValue("Basic", Convert.ToBase64String(Encoding.ASCII.GetBytes("login:password"))) }
            };
            // get ad_url by the ad_aclk
            // GET /v3/merchant/google/sellers/ad_url/$ad_aclk
            // use the ad_aclk that you received upon a sellers task
            string ad_aclk = "DChcSEwiSl5TKpbPoAhVFmdUKHfa_B_wYABADGgJ3cw&sig";
            var taskGetResponse = await httpClient.GetAsync("/v3/merchant/google/sellers/ad_url/" + ad_aclk);
            var result = JsonConvert.DeserializeObject(await taskGetResponse.Content.ReadAsStringAsync());
            if (result.tasks != null)
            {
                foreach (var taskResult in result.tasks)
                {
                    var fst = taskResult.First;
                    // you can find the full list of the response codes here https://docs.dataforseo.com/v3/appendix/errors
                    if (fst.status_code >= 40000 || fst.result == null)
                        Console.WriteLine($"error. Code: {fst.status_code} Message: {fst.status_message}");
                    else
                        // do something with result
                        Console.WriteLine(String.Join(Environment.NewLine, fst));
                }
            }
            else
                Console.WriteLine($"error. Code: {result.status_code} Message: {result.status_message}");
        }
    }
}

The above command returns JSON structured like this:

{
  "version": "0.1.20200923",
  "status_code": 20000,
  "status_message": "Ok.",
  "time": "0.6697 sec.",
  "cost": 1.0e-6,
  "tasks_count": 1,
  "tasks_error": 0,
  "tasks": [
    {
      "id": "09251613-1535-0187-0000-3470d7a062a8",
      "status_code": 20000,
      "status_message": "Ok.",
      "time": "0.5904 sec.",
      "cost": 1.0e-6,
      "result_count": 1,
      "path": [
        "v3",
        "merchant",
        "google",
        "sellers",
        "ad_url",
        "DChcSEwj2qKzGv_rrAhWXIK0GHbB0BQEYABAHGgJwdg"
      ],
      "data": {
        "se_type": "shops_list",
        "api": "merchant",
        "function": "sellers",
        "se": "google",
        "ad_aclk": "DChcSEwj2qKzGv_rrAhWXIK0GHbB0BQEYABAHGgJwdg"
      },
      "result": [
        {
          "ad_aclk": "DChcSEwj2qKzGv_rrAhWXIK0GHbB0BQEYABAHGgJwdg",
          "ad_url": "https://www.bikeinn.com/cykel/pedros-l-hex-set/136593131/p?utm_source=google_products&utm_medium=merchant&id_producte=5691630&country=dk&gclid=CJn0gqyxhOwCFQ5FGwodu_EHVw",
          "ad_url_redirects": [
            "http://clickserve.dartsearch.net/link/click?&ds_a_cid=96438518&ds_a_caid=10278814955&ds_a_agid=105173749329&ds_a_fiid=&ds_a_lid=pla-313383086779&&ds_e_adid=441825586499&ds_e_matchtype=&ds_e_device=c&ds_e_network=u&ds_e_product_group_id=313383086779&ds_e_product_id=DK-5691630&ds_e_product_merchant_id=6207387&ds_e_product_country=DK&ds_e_product_language=da&ds_e_product_channel=online&ds_e_product_store_id=&ds_url_v=2&ds_dest_url=https://www.bikeinn.com/cykel/pedros-l-hex-set/136593131/p?utm_source=google_products&utm_medium=merchant&id_producte=5691630&country=dk&gclsrc=aw.ds&",
            "https://clickserve.dartsearch.net/link/click?&ds_a_cid=96438518&ds_a_caid=10278814955&ds_a_agid=105173749329&ds_a_fiid=&ds_a_lid=pla-313383086779&&ds_e_adid=441825586499&ds_e_matchtype=&ds_e_device=c&ds_e_network=u&ds_e_product_group_id=313383086779&ds_e_product_id=DK-5691630&ds_e_product_merchant_id=6207387&ds_e_product_country=DK&ds_e_product_language=da&ds_e_product_channel=online&ds_e_product_store_id=&ds_url_v=2&ds_dest_url=https://www.bikeinn.com/cykel/pedros-l-hex-set/136593131/p?utm_source=google_products&utm_medium=merchant&id_producte=5691630&country=dk&gclsrc=aw.ds&",
            "https://ad.doubleclick.net/ddm/clk/282151716;108941074;c;u=ds&sv1=0&sv2=3202079229310002&sv3=3135623395883721351&gclid=CJn0gqyxhOwCFQ5FGwodu_EHVw;%3fhttps://www.bikeinn.com/cykel/pedros-l-hex-set/136593131/p?utm_source=google_products&utm_medium=merchant&id_producte=5691630&country=dk"
          ]
        }
      ]
    }
  ]
}