JanHalozan / iTunesConnectAnalytics

NodeJS package for iTunes Connect app analytics API
Other
143 stars 44 forks source link

Use of location #5

Closed commit-master closed 8 years ago

commit-master commented 8 years ago

Hey,

Is it possible to use location like on node-itunesconnect ? I want to retrieve the sales by countries, is there any way of doing this ?

Thanks.

shenoyroopesh commented 8 years ago

You could group it by countries something like this - (below also does filtering by a particular platform)

Something like this.

var query = new AnalyticsQuery.metrics(appId, {
      measures: [itc.measures.impressionsUnique],
      group: {metric: itc.measures.impressionsUnique, dimension: "storefront", rank: "DESCENDING", limit: 200},
      dimensionFilters: [{dimensionKey: "platform", optionKeys: ["iPhone"]}]
    }).date('2016-06-01', '2016-06-30');
shenoyroopesh commented 8 years ago

Some of these keys are missing right now in this module, I'll try to add it and contribute it back. But you can put them as string as above for now and it will work.

commit-master commented 8 years ago

We're getting close. The thing is that if i use the itc.measures.iap metric, I get only on value that is an addition of every in-app purchases. Do you know a way of getting them separately for each countries ?

shenoyroopesh commented 8 years ago

Seems to be working for me -

var query = new AnalyticsQuery.metrics(appId, {
      measures: [itc.measures.iap],
      group: {metric: itc.measures.iap, dimension: "storefront", rank: "DESCENDING", limit: 200},
      dimensionFilters: [{dimensionKey: "platform", optionKeys: ["iPhone"]}]
    }).date('2016-06-01', '2016-06-30');

If it's not working for you, could you show your exact query?

here: dimension "storefront" represents countries

commit-master commented 8 years ago

It does work for me. But I mean i have several different in-app purchases in my app. I want to have them separately for each countries. Like for example :

France : {
  'pack-1' : 23,
  'pack-2' : 123,
  'pack-3' : 2498
}

pack-1, pack-2.. being the different in-app purchases possible.

shenoyroopesh commented 8 years ago

Ah, ok.

The problem is iTunes Analytics doesn't give this data anyways, so I don't think the API supports it either (I dont' see anyway to do this in the Analytics dashboard).

Instead - why don't you use the sales report api? You can use the Autoingestion.class that apple provides to get this data (that one includes everything that's shown in your Sales report).

commit-master commented 8 years ago

I mean it's weird because I can do it with node-itunesconnect with the following code :

var SellPerCountry = Report('ranked', {
    limit   : 100,
    filters : {
        location: 143442,
        type: [
            itc.type.inapp,
            itc.type.app
        ],
        category: [6012]
    },
    group: 'content',
    measures: [itc.measure.units, itc.measure.proceeds]
}).time(1, 'days');
shenoyroopesh commented 8 years ago

Yes, that's because node-itunesconnect works for the reports/sales data - this particular library is for analytics - both are different sections in iTunes Connect. So for now I think you can use node-itunesconnect or Autoingestion.class. Until/unless someone implements the sales/reports part in this library too.

commit-master commented 8 years ago

Yeah I guess, well another work around would be to call for each particular country I want to monitor. Is it possible to like get the sessions of the day for one particular country of my app ?

shenoyroopesh commented 8 years ago

Even if you do it per country, it won't solve your problem right? The problem is it's not segregating by the in-app product within the same app - it's combining all in-apps into one number.

It's already segregating by countries above, but I don't see how moving the group condition for country to filter will solve the problem of getting in-app purchases by the pack name.

commit-master commented 8 years ago

Well I would get the sessions, installs and crashes from this library, and get the packs from the other library :)

(btw thanks for your time 👍 )

shenoyroopesh commented 8 years ago

So either use the group by to get data by country (like above), or move the country to the filter condition.

What you can do to form different queries is, just go to Analytics website, say using chrome- then use the developer tools - and see the request body in the api calls made for different queries you run on the report. Then just use the same in your code :).

JanHalozan commented 8 years ago

Hi guys, this is going to be a bit longer response since I wanna cover everything you talked about here.

This module is intended to provide data which you can see in the Analytics section of iTunes Connect. It's what's missing from node-itunesconnect which you already pointed out. The reason I don't want to include Sales section is because it is using an old API which I'm guessing will probably get removed in the future.

This module is however indeed currently missing the option to group the results and some other functionality as well which I intend to add as I have more time or I need it. If @shenoyroopesh can add the grouping functionality and submit a pull request that would be perfect otherwise I'll add it as soon as I have more time (probably over weekend).

The intention with this module is to provide a simple and easy to understand access to every possible option you can click and configure in iTunes Connect analytics section.

A workaround as @shenoyroopesh has already pointed out is to check how the request looks like when you're using actual iTunes Connect (with chrome developer tools, firebug, ...) and use the same parameter with your queries.

I hope that covers everything for now. If you need any additional info let me know.

You guys rock!

commit-master commented 8 years ago

Thanks for the answer @JanHalozan ! Indeed @shenoyroopesh workaround is really efficient and a great way to get the desired data. I have all the data I need now thanks to his method.

Thanks guys !

shenoyroopesh commented 8 years ago

@JanHalozan could you elaborate what you mean by implementing group functionality? The group added in the above code sample already works with whatever you have - what else are you looking for?

I was thinking of only adding the constants for easy reference (and maybe some more samples in the readme)

JanHalozan commented 8 years ago

Yes, exactly. Only to add the constants and examples.

commit-master commented 8 years ago

I am now trying to adapt your module for the Google Play Developper Console, I really don't get that part of your login process :

capture d ecran 2016-07-06 a 16 07 25

Care to explain to me ? Maybe you ever thought of adapting for google too ?

JanHalozan commented 8 years ago

Hi,

this module cannot be used for Google Play developer console statistics retrieval. They are using a completely different auth mechanism etc. It's a lot harder process with the google play dev console and I have a module for it (written in ruby) which is currently not public. It's a lot harder to get data from google because the login process is virtually impossible to reverse engineer.

If you're looking to integrate this data into some kind of a dashboard I might be able to recommend Databox (where I currently work) and we have a working integration for google play. If you're interested in knowing more we can talk in private when you have time.

If you're interested in the module I mentioned above (ruby version for G play) I can make it public but it's a lot more hacky and needs a few tweaks before it can go public.

shenoyroopesh commented 8 years ago

@JanHalozan sent a pull request.

JanHalozan commented 8 years ago

Was already on it :) @commit-master I hope that your issue is now resolved. Will close this one now. If you have any other problems / feature requests / anything else just open a new one and we'll talk there.

commit-master commented 8 years ago

Yeah well I would love to see your Ruby module to see how it's done. I will take a look to Databox too. Thanks a lot for your time !