Giter Site home page Giter Site logo

janhalozan / itunesconnectanalytics Goto Github PK

View Code? Open in Web Editor NEW
143.0 13.0 45.0 132 KB

NodeJS package for iTunes Connect app analytics API

License: Other

JavaScript 100.00%
itunesconnect analytics metrics analytics-api nodejs retrieve-data itunes-analytics

itunesconnectanalytics's People

Contributors

aljaazm avatar dctrotz avatar hugoduraes avatar janhalozan avatar kneeev avatar lozo2010 avatar shenoyroopesh avatar tmm1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

itunesconnectanalytics's Issues

Use of location

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.

Error after password change

I used the API for a few calls and then, since I was going to share my code, decided to change my password in itunes connect. After that I received the following error for example on the quickstart code.

var itc = require('itunesconnectanalytics');
var Itunes = itc.Itunes;
var AnalyticsQuery = itc.AnalyticsQuery;

var username = 'MyUserName';
var password = 'MyPassWord';
var appId = '12345'; //Found in My Apps -> App -> Apple ID or read below on getting the app id.

var instance = new Itunes(username, password, {
  errorCallback: function(e) {
    console.log('Error logging in: ' + e);
  },
  successCallback: function(d) {
    console.log('Logged in');
  }
});


instance.getApps(function(error, data) {
  console.log(JSON.stringify(data, null, 2));
});

returns Error: No account cookie :( Apple probably changed the login process.

Same also occurs with a new or incorrect user name or password. Any ideas how to address this?

Thanks

Ruby Google Play Developper Console.

Hey,

Since you closed the other issue I didn't found any other way to reach you but opening another issue, sorry about that. Could you please release your Ruby Tool so I can check the code and try to adapt it to my needs ? That would be really great !

Thank you again for your time.

Is this still working?

Hey!

First of all great job @JanHalozan ! I am working on a project that aggregates the analytics data from different platforms for my podcast.

I was wondering is this project still active? If so, are you accepting any new pull requests? I would love to convert this to promises, it would make my life much easier.
Thanks!

Status code 400 after log in

I can successfully log in and create a query, however, when I execute instance.request I get the following error message: (node:5597) UnhandledPromiseRejectionWarning: StatusCodeError: 400 . This only happens when I try to use Analytics Query. GetApps and GetSettings work just fine. Any idea what I'm doing wrong?

Here is what my code looks like, I basically copied it from READ.ME and updated the access tokens. I run this code from my terminal using node: node "file_name".js

`var itc = require('itunesconnectanalytics');
var Itunes = itc.Itunes;
var AnalyticsQuery = itc.AnalyticsQuery;

var username = '';
var password = '';
var appId = ''; //Found in My Apps -> App -> Apple ID or read below on getting the app id.

var instance = new Itunes(username, password, {
errorCallback: function(e) {
console.log('Error logging in: ' + e);
},
successCallback: function(d) {
console.log('Logged in');
}
});

// Get installs for each day in date range 2016-04-10 to 2016-05-10
var query = AnalyticsQuery.metrics(appId, {
measures: itc.measures.installs,
}).date('2016-04-10','2016-05-10');

instance.request(query, function(error, result) {
console.log(JSON.stringify(result, null, 2));
});`

[Enhancement] Subscriptions Support

It would be great if this could be expanded to Apple's new Subscription analytics. This could be used to track how many active subscriptions you have, and their daily change. In addition, it provides Retention and Conversion rates, as well as the number of free trials.

Data is returned as units, not as revenue for iap's

var query = new AnalyticsQuery.metrics(appId, { measures: [itc.measures.iap] }).time(10, 'days');

My query returns the correct number of IAP's purchased on these days, however it doesn't return the actual revenue made. Is there a way to modify this query to show this information?

Error: Cannot find module 'request'

Hi people, i'm testing this module but i have some problems.

I created a new empty node project with a new file "index.js" with this boilerplate code:

var itc = require('itunesconnectanalytics');
var Itunes = itc.Itunes;
var AnalyticsQuery = itc.AnalyticsQuery;

var username = 'UNAME';
var password = 'PASS';
var appId = '12345'; //Found in My Apps -> App -> Apple ID or read below on getting the app id.

var instance = new Itunes(username, password, {
  errorCallback: function(e) {
    console.log('Error logging in: ' + e);
  },
  successCallback: function(d) {
    console.log('Logged in');
  }
});

But when i run the command node index.js i get this error:

Error: Cannot find module 'request'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
    at Function.Module._load (internal/modules/cjs/loader.js:562:25)
    at Module.require (internal/modules/cjs/loader.js:690:17)
    at require (internal/modules/cjs/helpers.js:25:18)

thanks

What is "appleWidgetKey"?

Hi, I was beginning to write something similar to this library myself when I stumbled across this. (I had some issues getting login to work). I see there is a header sent "X-Apple-Widget-Key" during login, and you have a value hardcoded in the options. I tried to do some research on this to no avail. Can you explain what this is, and if I should be generating my own widget key for my usage? Thanks!

Edit: it appears this is a query parameter in the login url Apple uses for CSRF. Seems odd that you can just generate one and hardcode it though

StatusCodeError: 412

Connecting to iTunes Connect now results in a 412 error.

    const i = new itc.Itunes(
      config.appstore.login,
      config.appstore.password,
      {
        errorCallback: reject,
        successCallback: () => resolve(i),
      }
    );

Will reject with StatusCodeError: 412 - {"authType":"sa"} error.

See the PR below for a possible fix:
#52

Error module

please help: this module always working fine for me but recently it happened to show error from the module.
Like this:
C:\Users\Username\Documents\KITInternship\VKDashboard\node_modules\itunesconnectanalytics\src\analytics.js:42
var requestBody = query.assembleBody();
TypeError: Cannot read property 'assembleBody' of undefined

Race condition causes Invalid iTC User Role

Running a simple test.js like this (copied from examples):

var itc = require('itunesconnectanalytics');
var Itunes = itc.Itunes;
var AnalyticsQuery = itc.AnalyticsQuery;

var username = 'xxxxxxxx'; //REAL USERNAME AND PW REMOVED
var password = 'yyyyyyyy';

var appId = '12345'; //Found in My Apps -> App -> Apple ID or read below on gett
ing the app id.

var instance = new Itunes(username, password, {
  errorCallback: function(e) {
    console.log('Error logging in: ' + e);
  },
  successCallback: function(d) {
    console.log('Logged in');
  }
});

instance.getApps(function(error, data) {
  console.log(JSON.stringify(data, null, 2));
});

When I run this from the command line, I get inconsistent results. Some requests return the expected result (which confirms the roles are set up correcting in iTC). Also note that I consistently get the same server IP from apple/akamai, but some percentage of requests result in this error:

{
  "itcBaseUrl": "https://appstoreconnect.apple.com",
  "message": "Invalid iTC User Role",
  "l10n": {
    "Crossfire-response-invalidrole-message": "If you think you should have access to App Analytics, contact your iTunes Connect user with the admin role.",
    "Crossfire-response-invalidrole-link": "iTunes Connect Homepage",
    "Crossfire-response-invalidrole-title": "You don’t have access to App Analytics."
  },
  "redirectUrl": "/"
}

Other details :

NodeJS version: v6.11.3 (bundled with OS) and node v8.11.4 (latest) produce the same result.
OS version: RHEL 7.5. One theory is that their might be a race condition inside the library which produces different a different result based on the order of execution.

API documentation?

Thanks for making this package!

Do you happen to have a link to any documentation for the API -- I.e. the return data format, fields, error conditions, etc.? (My google-fu is failing me!) Or is it undocumented/reverse-engineered?

where can i find the provider ID?

in appstore i have a multiple account, i just want to switch between the accounts, i found the providerId solution. but i dont knw where to find it. i just want to know where can i find the provider ID, thanks in advance.

bug: group metric taking first char

I noticed that if you use the the group option with 1 metric, it takes the first char as group metric.
for example:

options = {
  measures:itc.measures.units,
  group: {
    dimension: itc.dimension.territory
  }
}

will result in:

"errors": [
      {
         "message": "Invalid measure: u"
      }
   ]

It happens because the query initialization happens before the assembleBody function, that puts the measures in an array.

No account cookie :( Apple probably changed the login process

When creating a new Itunes instance I got this error: No account cookie :( Apple probably changed the login process

Here is my code:

const instance = new Itunes(config.env.itunes.username, config.env.itunes.password, {
    errorCallback: (error) => {
      throw new BadRequestError(error);
    },
    successCallback: () => {
      console.log('Logged in');
    },
  });

I'm not sure how can I help with that.

Unicode output when trying to get app units for the specified time interval

Hi,
I was trying out your node js package and is currently facing some issue such that after logging when I am trying to get the app units metrics it's giving me the output in Unicode.

Code:

var itc = require('itunesconnectanalytics');
var Itunes = itc.Itunes;
var AnalyticsQuery = itc.AnalyticsQuery;

var username = 'XXXXX';
var password = 'XXXX';
var appId = 'XXXX'; //Found in My Apps -> App -> Apple ID or read below on getting the app id.

var instance = new Itunes(username, password, {
  errorCallback: function(e) {
    console.log('Error logging in: ' + e);
  },
  successCallback: function(d) {
    console.log('Logged in');
  }
});
var query = AnalyticsQuery.metrics(appId, {
    measures:  itc.measures.units,
  }).date('2018-04-10','2018-04-15');
  
  instance.request(query, function(error, result) {
    console.log(JSON.stringify(result, null, 2));
  });

Output:

Logged in
"\u001f�\b\u0000\u0000\u0000\u0000\u0000\u0000\u0000��AK\u0003A\f��Jȹ��\u0016�2G=\u0015�\"���C�����̘d\u0005Y����b=)x\f��K�\u001b0��!�Dtx6+�K*E-\u000b��\u0012{��9r�s�\u000b�X�N<��� �0ؙa�p\u0007A�g�t\u0006�Z0y\u0007:QH����*�\u001b�V��s\u0010����\\=Q+�ڳZe��콻8��F1������}6.�E�(���#���,PK\u001d���zݬ�����R��\u0012��Ŀ\"<R�g��;�x\u001c?\u0000F�3|�\u0001\u0000\u0000"

Data availability

Querying e.g. the last 7 days (e.g. units, sales) should only return the days for which Apple provided data.

Currently, the last days always have a value of 0, making it hard to distinguish if the value is really zero or if the data is not yet available.

Is there any API to accomplish that?

2FA always being asked for

When I first started using this, I only had to enter code the first time as the readme states, now it is being asked every time I run this. Was wondering if you could look into this!

Request fails if the computer is connected to another itunes account

Hi,

I noticed that if I'm logged in on iTunes connect in an account different than the one I'm making the request, it returns an error saying that the adamId is wrong, if I disconnect the account, or if I connect the same account it works fine. Is this the expected behavior or is this an issue?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.