{"_id":"56d1f34000a2a70b00b365ee","user":"5526d4bb4a7ac121004c605c","__v":7,"category":{"_id":"56d1f33900a2a70b00b36595","project":"5526c95cf69851170038b48f","version":"56d1f33700a2a70b00b3658e","__v":1,"pages":["56d1f34000a2a70b00b365ee","56d1f34000a2a70b00b365ef","56d1f34000a2a70b00b365f0","56d1f34000a2a70b00b365f1","56d1f34000a2a70b00b365f2","56d1f34000a2a70b00b365f3","56d1f34000a2a70b00b365f4","56d1f34000a2a70b00b365f5"],"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-04-10T15:44:07.282Z","from_sync":false,"order":5,"slug":"ionic-analytics","title":"Ionic Analytics"},"parentDoc":null,"version":{"_id":"56d1f33700a2a70b00b3658e","project":"5526c95cf69851170038b48f","__v":2,"createdAt":"2016-02-27T19:04:23.946Z","releaseDate":"2016-02-27T19:04:23.946Z","categories":["56d1f33900a2a70b00b3658f","56d1f33900a2a70b00b36590","56d1f33900a2a70b00b36591","56d1f33900a2a70b00b36592","56d1f33900a2a70b00b36593","56d1f33900a2a70b00b36594","56d1f33900a2a70b00b36595","56d1f33900a2a70b00b36596","56d1f33900a2a70b00b36597","56d1f33900a2a70b00b36598","56d1f33900a2a70b00b36599","56d1f33900a2a70b00b3659a","571f9497ada30c34003b7cee"],"is_deprecated":false,"is_hidden":false,"is_beta":true,"is_stable":true,"codename":"beta","version_clean":"2.0.0-beta","version":"2.0.0-beta"},"project":"5526c95cf69851170038b48f","updates":["559d131a2acc022100de21fa"],"next":{"pages":[],"description":""},"createdAt":"2015-04-10T18:26:29.613Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":0,"body":"## Why is analytics important?\n\nHow many users are on your app right now? How many of those will use your app tomorrow, or next week? Without information, you have no way of telling if your app is being used in the ways that you expect.\n\nIf you've completed the [Installation Guide](doc:analytics-install), your Ionic app is already collecting data. This will get you core data that you need to understand your userbase, like retention and user growth rates. \n\n## How does Ionic Analytics work?\n\nIn Ionic Analytics, each tracked action a user makes in your app is represented by an *event object*. An event is a single action done at a specific point in time. Examples are a purchase, scroll, signup, or login. \n\nEach event consists of an event type and data. The event type is a string saying what action the user  performed, like \"Accept TOS\" or \"Start New Game\". The event data is an object describing the details of the event. \n\n## What data does Ionic Analytics collect by default?\n\nAnalytics automatically collects Load events whenever the app is opened. The User object is attached to every event sent. \n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Event type\",\n    \"h-1\": \"Description\",\n    \"0-0\": \"Load\",\n    \"0-1\": \"Sent whenever a user opens your app.\"\n  },\n  \"cols\": 2,\n  \"rows\": 1\n}\n[/block]\nTo configure which data is sent by default, use the **$ionicAutoTrack** service:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"// in app.js\\n\\n.config(['$ionicAutoTrackProvider', function($ionicAutoTrackProvider) {\\n  // Stop tracking how many users open your app. \\n  $ionicAutoTrackProvider.disableTracking('Load');\\n}])\\n\\n.config(['$ionicAutoTrackProvider', function($ionicAutoTrackProvider) {\\n  // Don't track anything at all.\\n  $ionicAutoTrackProvider.disableTracking();\\n}])\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\n## Define your own events\nTo get the most out of Analytics, you can define custom events in your app with `$ionicAnalytics.track()`. Defining core events like \"Signup\" or \"Login\" early in development will ensure you have data later when you need it. \n\n**track()** takes the event type as a string, and a dictionary of event property / value pairs. Details are provided in the [tracking](doc:analytics-tracking) guide. Example:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"$ionicAnalytics.track('Rate Movie', {\\n    stars: 3,\\n    movie_id: 11,\\n  \\twatched_movie: true\\n});\\n\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]","excerpt":"","slug":"analytics-auto-tracking","type":"basic","title":"Overview"}
## Why is analytics important? How many users are on your app right now? How many of those will use your app tomorrow, or next week? Without information, you have no way of telling if your app is being used in the ways that you expect. If you've completed the [Installation Guide](doc:analytics-install), your Ionic app is already collecting data. This will get you core data that you need to understand your userbase, like retention and user growth rates. ## How does Ionic Analytics work? In Ionic Analytics, each tracked action a user makes in your app is represented by an *event object*. An event is a single action done at a specific point in time. Examples are a purchase, scroll, signup, or login. Each event consists of an event type and data. The event type is a string saying what action the user performed, like "Accept TOS" or "Start New Game". The event data is an object describing the details of the event. ## What data does Ionic Analytics collect by default? Analytics automatically collects Load events whenever the app is opened. The User object is attached to every event sent. [block:parameters] { "data": { "h-0": "Event type", "h-1": "Description", "0-0": "Load", "0-1": "Sent whenever a user opens your app." }, "cols": 2, "rows": 1 } [/block] To configure which data is sent by default, use the **$ionicAutoTrack** service: [block:code] { "codes": [ { "code": "// in app.js\n\n.config(['$ionicAutoTrackProvider', function($ionicAutoTrackProvider) {\n // Stop tracking how many users open your app. \n $ionicAutoTrackProvider.disableTracking('Load');\n}])\n\n.config(['$ionicAutoTrackProvider', function($ionicAutoTrackProvider) {\n // Don't track anything at all.\n $ionicAutoTrackProvider.disableTracking();\n}])", "language": "javascript" } ] } [/block] ## Define your own events To get the most out of Analytics, you can define custom events in your app with `$ionicAnalytics.track()`. Defining core events like "Signup" or "Login" early in development will ensure you have data later when you need it. **track()** takes the event type as a string, and a dictionary of event property / value pairs. Details are provided in the [tracking](doc:analytics-tracking) guide. Example: [block:code] { "codes": [ { "code": "$ionicAnalytics.track('Rate Movie', {\n stars: 3,\n movie_id: 11,\n \twatched_movie: true\n});\n", "language": "javascript" } ] } [/block]