OnSite Analytics: Changing Filter Values

Prev Next

The OnSite Analytics API enables you to change the filter values on OnSite campaign analytics from your back-end without using Insider One’s InOne panel.

Adding filters applies to all campaign stats.

Endpoint and Headers

Campaign analytics provide campaign results for the time period you selected.

POST analytics.api.useinsider.com/onsite/v2/all

Visit our Postman collection to test this request.

Header

Sample Value

Description

X-INS-AUTH-KEY

1a2b3c4d5e6f

This key is required to authorize your request. Refer to API Authentication Tokens to generate your token.

Query Parameters

You need to send the filters in the body parameters.

Parameter

Data Type

Description

Sample Value

Required

startTime

int64

Specifies a 10-digit epoch start time

1606669200

Yes

endTime

int64

Specifies a 10-digit epoch end time

1606755599

No

campaignReportType

String

The campaign report type to be used

"ab", "hundred"

Yes

selectedGoalType

String

The goal type of the data

“sales”, “click”, “salesFromClick”, “custom”

Yes

reportType

String

The report type for data to be fetched

“detail”, “summary”

Yes

filters

String

Used for filtering campaigns


Yes (if you would like to get filtered results)

field

String

Metrics used in analytics

“impression”,  “significance”

Yes (if you add filters)

operator

String

Used for searching for values in a given field.

”gte”, “gt”, “eq”, “lt”, “lte”

Yes (if you add filters)

value

Float

The value of the field.

0

No

If you do not add a filter parameter to the body, you will get the response with the default values. Refer to OnSite Analytics for more information.

If you add a filters parameter to the body and there is no value, the request is sent with the default values of the filters that you can see below:

"filters": [
        {
            "field": "impression",
            "operator": "gte",
            "value": 200
        },
        {
            "field": "significance",
            "operator": "gte",
            "value": 0
        }
    ]

Sample Request

Before sending the request, make sure:

  • To replace the authorization value with your own OnSite Campaign Analytics API key.

curl --location --request POST 'http://analytics.api.useinsider.com/onsite/v2/all' \
--header 'x-ins-auth-key: 1a2b3d4e5f6f' \
--header 'Content-Type: application/json' \
--header 'Cookie: __cf_bm=gmHgd380e4S4NpZSmkjvzKkoA2bLdRUEUYMXbznWdLc-1667922031-0-ASOX6zfoTQeAqs3SqMIgGSYIFLsMkGtpyFSm98zv9bb3gQEGAFOGBKR/wlCnIAL38LQfbCyv2DXCNgRszat+FA8=' \
--data-raw '{
    "startTime": 1646611200,
    "endTime": 1667222349,
    "campaignReportType": "ab",
    "selectedGoalType": "sales",
    "reportType": "detail",
    "filters": [
        {
            "field": "impression",
            "operator": "gte",
            "value": 90000
        },
         {
            "field": "significance",
            "operator": "gte",
            "value": 0.9
        }
    ]
}'

Sample Responses

200 OK

{
    "data": {
        "details": [
            {
                "activeDays": 239,
                "averageOrderValue": 260.53068340306834,
                "averageOrderValueUplift": 0.2435810228696742,
                "bayesianSignificance": 0.9999,
                "builderType": "custom",
                "campaignId": 8,
                "campaignName": "My campaign",
                "clickConversion": 19598,
                "clickThroughRate": 0.19069767441860466,
                "conversionRateUplift": 0.4216142270861831,
                "goalId": 0,
                "impression": 102770,
                "incrementalConversion": 1701.150115473441,
                "incrementalRevenue": 649101.4595842956,
                "revenue": 1494404,
                "revenueFromClick": 373601,
                "salesConversion": 5736,
                "salesConversionRate": 0.05581395348837209,
                "salesFromClick": 1434,
                "selectedGoalConversion": 5736,
                "selectedGoalConversionRate": 0.05581395348837209,
                "selectedGoalId": 0,
                "significance": 0.9999199999999999
            },
            {
                "activeDays": 239,
                "averageOrderValue": 227.98419339841934,
                "averageOrderValueUplift": 0.24369133790924957,
                "bayesianSignificance": 0.9999,
                "builderType": "custom",
                "campaignId": 20,
                "campaignName": "My amazing campaign",
                "clickConversion": 26768,
                "clickThroughRate": 0.2196078431372549,
                "conversionRateUplift": 0.39276018099547527,
                "goalId": 0,
                "impression": 121890,
                "incrementalConversion": 1213.1695906432751,
                "incrementalRevenue": 414566.7134502925,
                "revenue": 980788,
                "revenueFromClick": 217953,
                "salesConversion": 4302,
                "salesConversionRate": 0.03529411764705882,
                "salesFromClick": 956,
                "selectedGoalConversion": 4302,
                "selectedGoalConversionRate": 0.03529411764705882,
                "selectedGoalId": 0,
                "significance": 0.9999199999999999
            }
        ],
        "goalIdList": [
            1001362,
            1000090,
            1001132,
            1000781,
            1001436,
            1000768,
            1000030,
            1001092,
            1000718,
            1000594,
            1000765,
            1000988,
            1000744,
            1000742,
            1000854,
            1001399,
            1000881,
            1001088,
            1001390,
            1000731,
            1001200,
            1001121,
            1000795,
            1000239,
            1000699,
            1001389,
            1000709,
            1001439,
            1001133,
            1000852,
            1001151,
            1001449,
            1001090,
            1001120,
            1001017,
            1001152,
            1001205,
            1000948,
            1000858,
            1001074,
            1000712,
            1000774,
            1000720,
            1001049,
            1000801,
            1000786,
            1001184,
            1001319,
            1000707,
            1000743,
            1001169,
            1000949,
            1000798,
            1001019,
            1000991,
            1001025,
            1000968,
            1001323,
            1000831,
            1000368,
            1000688,
            1000713,
            1001354,
            1001102,
            1000853,
            1001172,
            1000685,
            1001096,
            1000708,
            1000797,
            1000824,
            1001318,
            1001060,
            1000916,
            1001353,
            1001081,
            1001136,
            1001016,
            1001104,
            1000261,
            1000704,
            1000755,
            1000884,
            1000754,
            1000751,
            1001029,
            1000933,
            1001251,
            1000741,
            1000244,
            1000819,
            1000726,
            1001208,
            1001440,
            1001199,
            1001003,
            1001083,
            1001437,
            1000730,
            1000827,
            1000830,
            1001113,
            1001028,
            1000715,
            1000951,
            1001014,
            1000800,
            1000823,
            1001293,
            1000820,
            1000862,
            1000767,
            1001030,
            1000193,
            1000947,
            1001298
        ]
    }
}

You can refer to Metric Definitions for further details.

  • 400  Bad Request: Sorry, we’ve received an invalid request from your side. You can try again later.

  • 400  Bad Request: Sorry, we received an invalid request. The start date cannot be after the end date.

  • 500  Internal Server Error: Sorry, we couldn’t receive any response from our server. You can try again later.

  • 406  Not Acceptable Request: Sorry, we received an invalid request. We are able to provide the analytics data for only the last 1 year.

Limitations

  • All functions must be executed with an HTTPS POST request.

  • The X-INS-AUTH-KEY should be provided as the authorization key in the request header. If the key is incorrect, the operation will not be executed, and an authorization error will return in the response.

  • This API provides data for a 1-year range.

  • You can send 100 requests/per minute with the same API Key. If you exceed the rate limit, you will receive a 429 error.

The default limit shown here is a standard baseline. If your use case requires higher capacity, feel free to reach out to the Insider One team. We can adjust it to fit your needs.