Search code examples
javascriptparse-platformanalytics

How to track app open in parse analytics using javascript?


I am using parse and I want to track app open and other events. I have seen an example in their documentation

 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);

This updates Analytics Requests on analytics dashboard.

How can I track App Opens?


Solution

  • I found the event name in documentation of REST api of analytics. So the code worked is:

    Parse.Analytics.track('AppOpened', { 'user': userObj}, function(response){
        // callback function
    });
    

    You can also track custom events just with your custom event name like:

    Parse.Analytics.track('CustomEvent', { 'user': userObj, 'otherInfo': otherInfo}, function(response){
        // callback function
    });
    

    You can see this in analytics tab -> events in left sidebar -> select custom breakdowns from list and you will see list of your custom events at right sidebar.