Statistics of Advertising Campaigns

campaign/stat

Parameters:

  • token — authorization (string)
  • id — id of the ad campaign (int)
  • category_id — category identifier (int)
  • period — the period of statistics (string, by default: today).
    Values:
    • today —today's day from 00:00 to the current hour
    • last_30 — statistics for the last 30 days
    • summary — general statistics for the ad campaign for all the time

You must specify the advertising campaign's identifier (id) OR the category identifier (category_id).

Example of the method request:

 $token,
        'id' => 999999,
        'period' => 'today'
    );
    if( $curl = curl_init() ) {
        curl_setopt($curl, CURLOPT_URL, 'https://www.ipweb.ru/api/v2/campaign/stat');
        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:

{
    "visits_hours": {
        "00:00-01:00": 0,
        "01:00-02:00": 0,
        "02:00-03:00": 0,
        "03:00-04:00": 0,
        "04:00-05:00": 0,
        "05:00-06:00": 0,
        "06:00-07:00": 3,
        "07:00-08:00": 1,
        "08:00-09:00": 12,
        "09:00-10:00": 0,
        "10:00-11:00": 0,
        "11:00-12:00": 23,
        "12:00-13:00": 16
    },
    "error_code": 0
}

====================================================================================

 $token,
        'id' => 999999,
        'period' => 'last_30'
    );
    if( $curl = curl_init() ) {
        curl_setopt($curl, CURLOPT_URL, 'https://www.ipweb.ru/api/v2/campaign/stat');
        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:

{
    "visits_30_days": {
        "28.10": 14,
        "29.10": 31,
        "30.10": 12,
        "31.10": 5,
        "01.11": 26,
        "02.11": 8,
        "03.11": 11,
        "04.11": 23,
        "05.11": 17,
        "06.11": 13,
        "07.11": 42,
        "08.11": 18,
        "09.11": 24,
        "10.11": 21,
        "11.11": 13,
        "12.11": 7,
        "13.11": 22,
        "14.11": 31,
        "15.11": 17,
        "16.11": 12,
        "17.11": 11,
        "18.11": 23,
        "19.11": 14,
        "20.11": 9,
        "21.11": 15,
        "22.11": 31,
        "23.11": 23,
        "24.11": 11,
        "25.11": 21,
        "26.11": 13
    },
    "error_code": 0
}

====================================================================================

 $token,
        'id' => 999999,
        'period' => 'summary'
    );
    if( $curl = curl_init() ) {
        curl_setopt($curl, CURLOPT_URL, 'https://www.ipweb.ru/api/v2/campaign/stat');
        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:

{
    "visits_hour": 3,
    "visits_today": 14,
    "visits_month": 154,
    "visits_all": 312,
    "error_code": 0
}
IPweb

Rate the material:

Rating: 5 out of 5. Total ratings: 2.
-