Managing your user data with Sitecore xDB

Preview:

Citation preview

Sitecore User Group Conference 2015 1

Managing your user data with xDB

Ruud van Falier

ParTech IT

ruud@partechit.nl /

@BrruuD

Sitecore User Group Conference 2015 2

Topics

• Prerequisites

• Extending the data model

• xDB Session State

• Loading & saving data

Sitecore User Group Conference 2015 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 4

Extending the data model

• Contacts

• Facets / Elements

• Manipulating the Contact object

Sitecore User Group Conference 2015 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 6

Sitecore User Group Conference 2015 7

User visits the site

Load contact from MongoDB

Contact exists inshared session?

Load contact fromshared session

Store contact inshared session

false

Sitecore User Group Conference 2015 8

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 9

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 10

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 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 12

Thank you

Recommended