0

I am new to CleverTap.

I want to get the number of new users in each of the previous 30 days. I can only view from the dashboard that today's new user number is shown. But how to read the values with API?

It was suggested that the query should be like this:

clevertap = CleverTap("idxxxx", "passcodexxxx")
query = {
    "event_name": "abc",
    "from": 20170505,
    "to": 20170609
    }

result = clevertap.events(query)
info = pd.read_json(json.dumps(result))

How can I get the number of new users?

Thank you very much.

Frankie
  • 744
  • 1
  • 9
  • 14

1 Answers1

1

You can get this answer by using the "Counts API, Trends" - https://support.clevertap.com/docs/api/working-with-counts.html#trends-api

The query should be as such

Endpoint: POST https://api.clevertap.com/1/counts/trends.json Headers: X-CleverTap-Account-Id, X-CleverTap-Passcode (Available under the settings section of your CleverTap Dashboard) & Content-Type header must be specified as application/json.

Query:

{
    "event_name": "App Launched",
    "session_properties": [{
        "name": "first_time",
        "value": "True"
    }],

    "from": 20170101,
    "to": 20170511,
    "unique": false,
    "groups": {
        "foo": {
            "trend_type": "daily"
        },
        "bar": {
            "trend_type": "weekly"
        },
        "foobar": {
            "trend_type": "monthly"
        }
    }
}

The "First Time" filter will select people who have launched your app for the first time in that time frame, i.e. new users!