Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Querying metrics #131

Open
skysteve opened this issue Oct 20, 2015 · 3 comments
Open

Querying metrics #131

skysteve opened this issue Oct 20, 2015 · 3 comments

Comments

@skysteve
Copy link

Hi, can you please add some docs on querying metrics? (Or link me to the page I'm struggling to find if it exists)

Also how do I query a metric and get a total value back?

If I request a metric I get back a link

{
        "name": "Metrics Over Time Query",
        "rel": "metric-over-time",
        "href": "https://api.kissmetrics.com/query/metrics/4ec26890-b767-0132-875f-22000ab4dcd7/over-time",
        "templated": false
    }

which I've had to hack around with to find I need to POST to with start_at and end_at date in the body. However I now want a total for the range like I get from the UI (see below)

screen shot 2015-10-20 at 3 05 06 pm

However the API just seems to return me

[{"timestamp":"2015-10-14","year":2015,"month":10,"day":14,"value":12}]

(after jumping through the status update/results request cycle)

So how do I ask the API to give me a total? Because the total is obviously unique users, where as if I add up the various values they won't be unique.

Hope you can help
Steve

@salomon
Copy link
Contributor

salomon commented Oct 20, 2015

Hi Steve,

Sorry about the confusion. Unfortunately, currently the API does not have the ability to query the unique visitor total for the entire date range. The good news is that we are building out a v2 of the API and that version will indeed have that ability.

As for the docs, I'll put it on our to-do-list and we'll make sure that's clarified because after looking it over, I agree with you that it's not clear.

Let us know if you're having any other issues and if there's any functionality that you'd like us to consider for v2.

Thanks,
Ryan

@skysteve
Copy link
Author

Thanks Ryan.

TBH I've not done enough with the API to know what else would be good in v2 but I'll let you know if I think of/see anything.

@salomon
Copy link
Contributor

salomon commented Oct 22, 2015

Hi Steve,

This actually is doable -- I forgot that you can use our people search endpoint to get this number. What you'll want to do is the following:

Step 1: Create a people report (in the web interface) with the criteria you're looking for and make sure to save the report.
Step 2: Ping the following endpoint (with needed headers) to return the list of reports -- https://api.kissmetrics.com/core/reports
Step 3: Ping that people report's endpoint to return the results of the report for the specified date range.

Here's a link to our support doc on those last 2 steps: http://support.kissmetrics.com/api-update.html

I'll be out of the office for the rest of this week, but let me know if you have any questions.

Thanks,
Ryan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants