How to use Analytics

#1

I see there an Adapter for Analytics how to use it and how I can display Analytics on the dashboard

#2

As far as I’m aware there are no analytics adapters & no analytics integration on the default Parse dashboard.

See the section from the Parse Server Guide on compatibility with Parse.com

Parse Analytics is not supported. We recommend sending analytics to another similar service like Mixpanel or Google Analytics.

#3

i see this before but i wonder about this one


also on back4app the analytics dashboard are the same to the old one
is there any way to add this…

also on the dashboard i can access this page

#5

also i can log through SDK

var dimensions = {
  // Define ranges to bucket data points into meaningful segments
  priceRange: '1000-1500',
  // Did the user filter the query?
  source: 'craigslist',
  // Do searches happen more often on weekdays or weekends?
  dayType: 'weekday'
};
// Send the dimensions to Parse along with the 'search' event
Parse.Analytics.track('search', dimensions);
#6

I wasn’t aware of this, it seems to allow you to hook up your Parse Server to Google Analytics with some configuration - see this PR for details. However, I don’t believe this is documented or really used so it’s a bit of an unknown as to how well it works.

Back4App runs its own very customised fork of the open source Parse Dashboard so the simple answer is no.

I believe that is a left over API from Parse.com days but this won’t work with Parse Server out of the box. Although, I think if you followed the steps here (and quoted below) then the SDK analytics calls may work.

I’ve created simple analytics adapter using universal-analytics for GA

var ua = require('universal-analytics');

class AnalyticsAdapter {
  constructor(tracking_id) {
    this._tracking_id = tracking_id;
  }

  appOpened(parameters, req) {
    return Promise.resolve({});
  }

  trackEvent(eventName, parameters, req) {
    var visitor;
    if (typeof(req.auth.user) !== 'undefined') {
      visitor = ua(this._tracking_id, req.auth.user.id);
    } else {
      visitor = ua(this._tracking_id);
    }
    var params = {
      ec: eventName,
      ea: parameters.action || eventName,
      el: parameters.label || '',
      ev: parameters.value || 0,
      dp: parameters.page || req.originalUrl
    }
    visitor.event(params).send();
    return Promise.resolve({});
  }
}

exports.AnalyticsAdapter = AnalyticsAdapter;

create a file with that, put it in lib/analytics_adapter.js, then import it:

var AnalyticsAdapter = require('../lib/analytics_adapter.js').AnalyticsAdapter;

and pass to your ParseServer:

var api = new ParseServer({
  analyticsAdapter: new AnalyticsAdapter(process.env.GA_TRACKING_ID),
  (...)

you’ll also need to add

"universal-analytics": "^0.4.2"

to your dependencies in package.json

1 Like
Allow usage of built-in analytics adapter