I hope I donβt have the wrong end of the stick here (as always the documentation on the side-card is terrible!)
I need a way to store information against the visitor, I'm fairly new to sitecore, but the contact faces were the perfect solution , I implemented word for word from the above link to a large extent, until it got into production, I was very pleased with this. When I saved the information, it was saved, I could read it:
public IMpmVisitorFacet GetMpmVisitorFacet() { return _contact.GetFacet<IMpmVisitorFacet>(_MPMVisitorConfigName); }
and set up the information, and everything seemed gorgeous. I could also see that sitecore SC_ANALYTICS_GLOBAL_COOKIE installed, everything seemed wonderful. Then I did some more thorough tests ...
The problem is that the data simply does not last long. If I put some information on the facet, it will stand for about an hour or so (I can close the browser, look at other sites, etc. Etc.), And I can access it, but after the "amount time, "itβs just leaving.
After reviewing the documents (I already mentioned that they are not very good), I noticed a reservation in a sentence that I had not seen before:
Well, I can create another page of the web form that only reads the employee number. This will show me that the contact facet data is stored at least in memory. But what about persistent storage?
Hold on, I thought this was a permanent store ?! Thus, the example shows some code for reading "facet".
var contact = Tracker.Current.Contact; var data = contact.GetFacet<IEmployeeData>("Employee Data"); data.EmployeeId = "ABC123"; ..... <p>Employee data contact facet updated.</p> <p>Contact ID: <b><%=contact.ContactId.ToString()%></b></p> <p>Employee #: <b><%=data.EmployeeId%></b></p>
But this line seems to exist only for a short period of time. Then it continues:
For performance reasons, Sitecore only writes contact information to xDB when the session ends. That means if I look in MongoDB ...
Then he continues to show the data in it with a new brilliant fashionable implementation of mongoDb. But what use is it in mongo if I cannot access this information and use it programmatically!
So the question is, how do I access this contact information after the session is left?
i.e. the user is registered on my site β I add some information to their contact face β they return the next day β I want to read the previously added information
There are several other documents that talk about access to this data in the experimental profile , in the index in Lucene and in the Experience platform (why are there two products with almost the same name ?!), but there is nothing to say how to access this information on the web itself -site in code.
To add to the comments of Dmitry Shevchenko :
- I can see my user in the "experience profile", and I can see my site visits.
- I know that this user had additional information about the facet because it caused some code.
- I can find my user (from the identifier displayed from the query string to the experience profile page) in mongo Db
- But when I look at the user in mongoDb, the additional information is not there.
- Some contact entries have this information, but others do not
So it seems that the problem is related to writing new information in mongo . Anyone have any help or similar experience?