Geo-settings for Advertising Campaigns

Viewing

campaign/geo

Parameters:

  • token — authorization (string)
  • id — id of the ad campaign (int)

Example of the method request:

<?php
    $post = array(
        'token' => $token,
        'id' => 999999
    );
    if ($curl = curl_init()) {
        curl_setopt($curl, CURLOPT_URL, 'https://www.ipweb.ru/api/v2/campaign/geo');
        curl_setopt($curl, CURLOPT_RETURNTRANSFER,true);
        curl_setopt($curl, CURLOPT_POST, true);
        curl_setopt($curl, CURLOPT_POSTFIELDS, $post);
        $out = curl_exec($curl);
        echo $out;
        curl_close($curl);
    }

// Result:

{
    "countries": {
        "geo_ru": {
            "name": "Russia", // region name
            "checked": true, // selected or not
            "count": 84836 // approximate number of visits per day
        },
        "geo_ua": {
            "name": "Ukraine",
            "checked": false,
            "count": 22551
        },
        ...
    },
    "ru_regions": {
        "region_105": {
            "name": "Moscow",
            "checked": true,
            "count": 17419
        },
        "region_106": {
            "name": "Saint Petersburg",
            "checked": true,
            "count": 5551
        },
        ...
    },
    "ua_regions": {
        "region_10": {
            "name": "Kiev",
            "checked": false,
            "count": 9226
        },
        "region_21": {
            "name": "Donetsk region",
            "checked": false,
            "count": 3692
        },
        ...
    },
    "error_code": 0
}

Setting Regions

campaign/geo_set_by_names

Parameters:

  • token — authorization (string)
  • regions — names of regions separated by commas (string)

Параметр regions can also contain the code or names of the macroregion:

  • all_world - The whole world
  • europe - Europe
  • asia - Asia
  • russia - Russia
  • usa - USA
  • africa - Africa
  • america - America
  • south_asia - South Asia
  • southeast_asia - Southeast Asia
  • english_language - English language
  • spanish_language - Spanish language
  • portuguese_language - Portuguese language
  • arabic_language - Arabic language
  • russian_language - Russian language
  • french_language - French language
  • latam - LATAM
  • mena - MENA

Example of the method request:

<?php
    $post = array(
        'token' => $token,
        'id' => 999999,
        'regions' => 'moscow,spb,yaroslavl,sverdlovsk'
    );
    if ($curl = curl_init()) {
        curl_setopt($curl, CURLOPT_URL, 'https://www.ipweb.ru/api/v2/campaign/geo_set_by_names');
        curl_setopt($curl, CURLOPT_RETURNTRANSFER,true);
        curl_setopt($curl, CURLOPT_POST, true);
        curl_setopt($curl, CURLOPT_POSTFIELDS, $post);
        $out = curl_exec($curl);
        echo $out;
        curl_close($curl);
    }

// Result:

{
    "status": "ok",
    "error_code": 0
}

    $post = array(
        'token' => $token,
        'id' => 999999,
        'regions' => 'portuguese_language,English language'
    );
    if ($curl = curl_init()) {
        curl_setopt($curl, CURLOPT_URL, 'https://www.ipweb.ru/api/v2/campaign/geo_set_by_names');
        curl_setopt($curl, CURLOPT_RETURNTRANSFER,true);
        curl_setopt($curl, CURLOPT_POST, true);
        curl_setopt($curl, CURLOPT_POSTFIELDS, $post);
        $out = curl_exec($curl);
        echo $out;
        curl_close($curl);
    }

// Результат:

{
    "status": "ok",
    "error_code": 0
}
IPweb

Rate the material:

Rating: 3.75 out of 5. Total ratings: 4.