Git Product home page Git Product logo

ionic1-flurry-marketplugin's People

Contributors

lakshaydulani avatar

Stargazers

 avatar

Watchers

 avatar  avatar

ionic1-flurry-marketplugin's Issues

Ionic + Flurry: setUserId

I'm new to Angular and Flurry. I'm creating a project with Ionic and I want to implement Flurry with it.

Everything looks fine (logEvents) except for my setUserId function. I have the following Service:

.service('flurryService', function () {

// create a new instance
this.init = function () {

  var options = {
    logLevel: 'DEBUG',                  // (VERBOSE, DEBUG, INFO, WARN, ERROR)
    enableLogging: true,                // defaults to false
    enableEventLogging: true,          // should every event show up the app's log, defaults to true
    enableCrashReporting: true,         // should app crashes be recorded in flurry, defaults to false, iOS only
    enableBackgroundSessions: true,     // should the session continue when the app is the background, defaults to false, iOS only
    reportSessionsOnClose: true,       // should data be pushed to flurry when the app closes, defaults to true, iOS only
    reportSessionsOnPause: true        // should data be pushed to flurry when the app is paused, defaults to true, iOS only
  }


  // workaround - create a blank flurryAnalytics for development site since FlurryAnalytics will be available on devices only
  if (window.cordova)
    this.flurryAnalytics = new FlurryAnalytics();
  else
    this.flurryAnalytics = {
      logEvent: function () {}, init: function () {}, logError: function(a,b){console.error(a,b);}
    };


  if(ionic.Platform.isAndroid()){
    flurry_id = 'MYFLURRYID';
  } else { //iOS
    flurry_id = 'MYFLURRYID';
  }

  this.flurryAnalytics.init(flurry_id, options, function () {}, function (err) {});

};

this.logEvent = function (title, obj) {
  if(this.flurryAnalytics)
  this.flurryAnalytics.logEvent(title, obj, function () {}, function () {});
};

this.logError = function (title, error) {
  if(this.flurryAnalytics)
 this.flurryAnalytics.logError(title, error, function () {}, function (err) {});
};

**// PS I created this function**
this.setUserId = function (id) {
  if(this.flurryAnalytics)
  this.flurryAnalytics.setUserId(id, function () {}, function (err) {});
};
})

Inside my login page I injected flurryService and tried to call setUserId function after the login is checked. PS: this is just a very simplified example of the code/idea of my controller.

.controller('homeCtrl', function($scope, $http, flurryService) {

$scope.login = function (){

encodedata=JSON.stringify({
"email": email,
"password": password});

$http({
method : 'POST',
url : '/login',
data : encodedata
})
.success(function(data) {

      var result = data.split('|');
      var user_id = result[1];

      flurryService.setUserId(user_id);

      });
};

})

The problem is that I'm getting the following error:

services.js:34 TypeError: this.flurryAnalytics.setUserId is not a function

Line 34 is this one:
logEvent: function () {}, init: function () {}, logError: function(a,b){console.error(a,b);}

Does anyone know how can I solve this and be able to seUserId inside my function?

Thanks for any help!

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.