Managing your
user data with xDB
Ruud van Falier
ParTech IT
ruud@partechit.nl / @BrruuD
Sitecore User Group Conference 2015 1
Topics
• Prerequisites
• Extending the data model
• xDB Session State
• Loading & saving data
Sitecore User Group Conference 2015 2
Prerequisites
• Install MongoDB
• Teach yourself some MongoDB!
http://docs.mongodb.org/manual/
• Get RoboMongo (it’s free!):
http://robomongo.org/
• Get the RoboMongo UUIDHelper:
https://github.com/mongodb/mongo-csharp-driver/blob/master/uuidhelpers.js
Sitecore User Group Conference 2015 3
Extending the data model
• Contacts
• Facets / Elements
• Manipulating the Contact object
Sitecore User Group Conference 2015 4
xDB Session State
• Private vs Shared
• InProc vs OutProc
• Contact data is loaded into a SessionContext (shared session)
• Manipulation is done in the SessionContext (shared session)
• SessionContext is flushed to MongoDB on session end
• Working directly on MongoDB is not adviced
Sitecore User Group Conference 2015 5
Sitecore User Group Conference 2015 6
Sitecore User Group Conference 2015 7
User visits the site
Load contact from
MongoDB
Contact exists in
shared session?
Load contact from
shared session
Store contact in
shared session
false
Loading & saving data (during a request)
• Anonymous Contact
• Load Contact into shared session during a request
Sitecore.Analytics.Tracker.Current
.Session.Identify(uid);
• Saving occurs in session
• Session is flushed to MongoDB
Sitecore User Group Conference 2015 8
Loading & saving data (e.g. during import)
• Tracker.Current is null
• Load Contact directly from MongoDB (no shared session, readonly)
• Load Contact from shared session or from MongoDB into shared
session (TryLoadContact)
Sitecore User Group Conference 2015 9
Tips
• Start with a POC
• Create extension methods & abstractions
• Reflector is your friend
• Not discussed, but important when working with xDB:
Contact merging, Analytics index, Processing framework
• Do not underestimate the complexity
• Use SOLR for your Analytics index
Sitecore User Group Conference 2015 10
Time for questions
• Follow me: @BrruuD
• Mail me: ruud@partechit.nl
• Skype me: brruud
• Read my blog: http://www.partechit.nl/blog
• Demo code: https://github.com/ParTech/SugCon2015
*pssst* … Interested in indie game development? Follow @rumargaming
Sitecore User Group Conference 2015 11
Thank you
Sitecore User Group Conference 2015 12

Managing your user data with Sitecore xDB

  • 1.
    Managing your user datawith xDB Ruud van Falier ParTech IT ruud@partechit.nl / @BrruuD Sitecore User Group Conference 2015 1
  • 2.
    Topics • Prerequisites • Extendingthe data model • xDB Session State • Loading & saving data Sitecore User Group Conference 2015 2
  • 3.
    Prerequisites • Install MongoDB •Teach yourself some MongoDB! http://docs.mongodb.org/manual/ • Get RoboMongo (it’s free!): http://robomongo.org/ • Get the RoboMongo UUIDHelper: https://github.com/mongodb/mongo-csharp-driver/blob/master/uuidhelpers.js Sitecore User Group Conference 2015 3
  • 4.
    Extending the datamodel • Contacts • Facets / Elements • Manipulating the Contact object Sitecore User Group Conference 2015 4
  • 5.
    xDB Session State •Private vs Shared • InProc vs OutProc • Contact data is loaded into a SessionContext (shared session) • Manipulation is done in the SessionContext (shared session) • SessionContext is flushed to MongoDB on session end • Working directly on MongoDB is not adviced Sitecore User Group Conference 2015 5
  • 6.
    Sitecore User GroupConference 2015 6
  • 7.
    Sitecore User GroupConference 2015 7 User visits the site Load contact from MongoDB Contact exists in shared session? Load contact from shared session Store contact in shared session false
  • 8.
    Loading & savingdata (during a request) • Anonymous Contact • Load Contact into shared session during a request Sitecore.Analytics.Tracker.Current .Session.Identify(uid); • Saving occurs in session • Session is flushed to MongoDB Sitecore User Group Conference 2015 8
  • 9.
    Loading & savingdata (e.g. during import) • Tracker.Current is null • Load Contact directly from MongoDB (no shared session, readonly) • Load Contact from shared session or from MongoDB into shared session (TryLoadContact) Sitecore User Group Conference 2015 9
  • 10.
    Tips • Start witha POC • Create extension methods & abstractions • Reflector is your friend • Not discussed, but important when working with xDB: Contact merging, Analytics index, Processing framework • Do not underestimate the complexity • Use SOLR for your Analytics index Sitecore User Group Conference 2015 10
  • 11.
    Time for questions •Follow me: @BrruuD • Mail me: ruud@partechit.nl • Skype me: brruud • Read my blog: http://www.partechit.nl/blog • Demo code: https://github.com/ParTech/SugCon2015 *pssst* … Interested in indie game development? Follow @rumargaming Sitecore User Group Conference 2015 11
  • 12.
    Thank you Sitecore UserGroup Conference 2015 12

Editor's Notes

  • #13 DO NOT REMOVE THIS SLIDE