Ionic Analytics - failed to include into app

Hi folks,

I’m trying to add Ionic Analytics service to my app and get the following error while trying in in the browser:

Uncaught Error: You must provide an app id and api key to identify your app before tracking analytics data.

Before that I did the following (in the folder of my app):

$ sudo npm install -g cordova ionic
$ ionic upload
$ bower install ionic-service-core --save
$ bower install ionic-service-analytics --save

While debugging the issue I’ve checked the following things:

  1. I see the app created at my account at ionic.io with app id and app
    key
  2. The same app id and app key are added to a file .io-config.json to my project
  3. My module contains the following new code:
    angular.module('main', [
      'ionic',
      'ionic.service.core',
      'ionic.service.analytics',
      ...

I run “gulp watch” and see the error: “Uncaught Error: You must provide an app id and api key to identify your app before tracking analytics data.” which leads to ionic-analytics.js. In case I remove ‘ionic.service.analytics’, from module pre-requisites the app works fine.

I didn’t find any suggestions how to specify my app key and app id in any way in the ionic doc. It seem like it’s assumed that if I did “ionic upload” correctly it should work out of box (apparently it’s not).

Could somebody point me out to my problem?

Thanks,
Shamil

Small update on the issue. After few more attempts - I have create an app with ‘ionic start’ and followed the rest of instructions, and it worked fine for me.

Initially I created the app with yeoman, not native ionic.

So, for now the issue is not relevant any longer more me.

Thanks :smile: