Traffic Source

Returns the amount of impressions, clicks, orders, revenue, cvr and ctr for Newsletters, Triggered Emails, Recommendation Engine and Pop-ups

Method: GET

URL: https://api.retargeting.app/v1/partners-api/traffic-source

Function parameters

Field Type Required Description
rest_key number or text True The REST API Key of the client.
date_from number Optional (Required only if date_to parameter is given) Unix Timestamp (Example: 1711126978). If not provided, default fallback is 30 days in the past from now.
date_to number Optional Unix Timestamp (Example: 1713718978). If not provided, default fallback is the current time.

The interval between date_from and date_to parameters (if provided) must not exceed 30 days.

Your account status must be in one of the states: PAID, PAYMENT ERROR or ACCOUNT SUSPENDED.

If your account is Inactive or Closed the API call will not work.

The API call will respond with JSON format.

Example

"vendor/autoload.php";

    $apiURL = "https://api.retargeting.app/v1/partners-api/traffic-source";
    $apiKey = "REST_KEY";

    $client = new GuzzleHttp\Client();

    $registerData = [
        "rest_key" => $apiKey,
    ];

    $request = $client->request("GET", $apiURL, ["query" => $registerData]);
                    

If the API call succeeds, then the response will be as seen below:

{
    status: "success",
    data: [
        {
            impressions: 339895,
            click: 4629,
            order: 16,
            revenue: 3849,
            source_name: "Newsletter",
            cvr: "0.35",
            ctr: "1.36"
        },
        {
            impressions: 14056,
            click: 1743,
            order: 19,
            revenue: 3926,
            source_name: "Triggered Emails",
            cvr: "1.09",
            ctr: "12.40"
        },
        {
            impressions: 291737,
            click: 7056,
            order: 219,
            revenue: 54635,
            source_name: "Rec. Engine",
            cvr: "3.15",
            ctr: "2.42"
        },
        {
            impressions: 0,
            click: 0,
            order: 0,
            revenue: 0,
            source_name: "Pop-ups",
            cvr: "0.00",
            ctr: "1.00"
        }
    ]
}
                    

If the API call fails, then the responses will be similar to the ones below:

When the rest_key parameter is invalid:

{
    status: "error",
    message: "Incorrect rest key!"
}
                    

When the account is not active:

{
    status: "error",
    message: "Your account is not active!"
}
                    

When the interval between date_from and date_to parameters is greater than 30 days:

{
    status: "error",
    message: "Interval is greater than 30 days"
}
                    

When date_from parameter is not provided together with date_to parameter:

{
    status: "fail",
    data: {
        validator: {
            date_from: [
                "The date from field is required when date to is present."
            ]
        }
    }
}
                    

When something went wrong:

{
    status: "error",
    message: "Something went wrong"
}