We have just upgraded our 7.2 platform to 8.1. We have enabled xDB as well.
I've following questions:
- Do we need to write any custom code (JS or C#code) to capture analytics data on to xDB?
- What sort of data is captured by default and what sort of data requires custom code?
Thanks.
1) No custom code is required by default. You just need to make sure that configuration files are properly setup. Sitecore Analytics and xDB features are enabled when you install Sitecore. In Sitecore 8.0 you only need to have "Analytics.Enabled" set on "true" in Sitecore.Analytics.config but in Sitecore 8.1 because they have introduced the notion of separation of xDB and core sitecore functionality you also need to have the extra license for xDB and having "Xdb.enabled" in Sitecore.Xdb.config as well. Also make sure that you have an installed and running MongoDB on your machine since xDB is actually consisted of MongoDB and SQL server (both)
Also have a look on following links about CMS-only mode in Sitecore 8.1:
Sitecore 8.1: what does new CMS-only mode mean
2) Sitecore xDB collects visitors' information in "Contacts" collection on MongoDB and the actual visits in "Interaction" collection on MongoDB (in JSON format) and then it processes raw data to generate statistics and store them into SQL server (separate database for analytics). In general, Sitecore shows you various statistics based on "PageViews" and "Engagement Values" side by side on dozens of charts. Checkout "ReportDataView" and "TrafficOverview" views on SQL server (once you setup xDB up and running) to have some ideas about what is it doing.
Anyway, in many cases you may find the ready-to-use charts and graphs are not enough so you can also have direct access to raw data in MongoDB or aggregated counterpart in SQL server and you can also write your extra pieces of info on each page so that you can extract them later on Experience Analytics.