« Back to Documentation Overview

get_contacts_subscription_stats

Section: Contacts
Version: 1.5.0


Get contacts subscription stats aggregated by time period, campaign and contact’s origin.
Conditions:

  • campaigns / get_campaigns (optional) – Get statistics only for given campaigns. Uses OR logic. If those params are not given statistics are returned from all campaigns on the account. Check IDs in conditions for detailed explanation.
  • created_on (optional) – Use time operators to narrow down search results to specific contact creation date. Multiple operators are allowed and logic AND is used so date range can also be expressed.
  • grouping (optional) – Determines period of time by which stats are aggregated. Allowed values are: hourly (result keys in "YYYY-MM-DD HH" format), daily (result keys in "YYYY-MM-DD" format), monthly (result keys in "YYYY-MM" format) and yearly (result keys in "YYYY" format). Default is daily.

Warning: Graduation may not be continuous. Given time period is present in result only if it has at least one positive value in it.


Parameters
stringAPI_KEY
object
arraycampaigns
stringCAMPAIGN_ID
stringCAMPAIGN_ID
objectget_campaigns
objectname
stringCONTAINSmy_campaign_%
objectcreated_on
stringOPERATORvalue
stringgroupingmonthly
Return Value
object2010-01-01
objectCAMPAIGN_ID
integeriphone8
integerwwwget_contacts_subscription_stats_www_0_integer
integersaleget_contacts_subscription_stats_sale_0_integer
integerleads64
integerforwardget_contacts_subscription_stats_forward_0_integer
integerpanelget_contacts_subscription_stats_panel_0_integer
integerapi512
integerimport16
integeremailget_contacts_subscription_stats_email_0_integer
integersurveyget_contacts_subscription_stats_survey_0_integer
integercopy1
integerlanding_pageget_contacts_subscription_stats_landing_page_0_integer
object2010-01-02
objectCAMPAIGN_ID
integeriphoneget_contacts_subscription_stats_iphone_0_integer
integerwwwget_contacts_subscription_stats_www_0_integer
integersaleget_contacts_subscription_stats_sale_0_integer
integerleads128
integerforwardget_contacts_subscription_stats_forward_0_integer
integerpanelget_contacts_subscription_stats_panel_0_integer
integerapi2048
integerimportget_contacts_subscription_stats_import_0_integer
integeremailget_contacts_subscription_stats_email_0_integer
integersurveyget_contacts_subscription_stats_survey_0_integer
integercopyget_contacts_subscription_stats_copy_0_integer
integerlanding_pageget_contacts_subscription_stats_landing_page_0_integer

Example Request JSON

[
    "API_KEY",
    {
        "campaigns": [
            "CAMPAIGN_ID",
            "CAMPAIGN_ID"
        ],
        "get_campaigns": {
            "name": {
                "CONTAINS": "my_campaign_%"
            }
        },
        "created_on": {
            "OPERATOR": "value"
        },
        "grouping": "monthly"
    }
]

Example Response JSON

{
    "2010-01-01": {
        "CAMPAIGN_ID": {
            "iphone": 8,
            "www": 0,
            "sale": 0,
            "leads": 64,
            "forward": 0,
            "panel": 0,
            "api": 512,
            "import": 16,
            "email": 0,
            "survey": 0,
            "copy": 1,
            "landing_page": 0
        }
    },
    "2010-01-02": {
        "CAMPAIGN_ID": {
            "iphone": 0,
            "www": 0,
            "sale": 0,
            "leads": 128,
            "forward": 0,
            "panel": 0,
            "api": 2048,
            "import": 0,
            "email": 0,
            "survey": 0,
            "copy": 0,
            "landing_page": 0
        }
    }
}
API-wide Errors
API key verification failed API key verification failed
API client IP not allowed API client IP not allowed
Invalid params Attribute params must be reference to hash