Jeroen
Jeroen

Reputation: 13

Sitecore save visitor information

I'm new to Sitecore. I have a question about saving a value for a visitor in Sitecore. I want to save a value for the visitor, the next time the visitor comes to the website I want to retrieve this value.

I tried to use Tracker.Visitor.Tag, but this is session scoped. In the next visit the tags are gone.

Is it possible to save visitor specific information to the Sitecore database?

Thank you!

Upvotes: 0

Views: 940

Answers (1)

Mark Ursino
Mark Ursino

Reputation: 31435

There's nothing particularly special about Sitecore databases for non-authenticated users. Since your users are anonymous, think of it as a standard ASP.NET feature, so you can use session or cookies to persist something. The Sitecore databases really store CMS-driven content, and if necessary, data about specific users in the Core database, however these are authenticated users (built on top of ASP.NET Membership).

One thing to consider is how you want to use this information (perhaps you can elaborate at a higher level of what you're trying to accomplish?). The reason I say this is that if you update a component with user-specific data, if the component caches the HTML output in Sitecore, it will not change per user unless you cache by the exact criteria for which you deem to be a "unique user." This would require a bit of extra work to cache and "Vary by Params" where those params are your custom criteria.

E.g.

  1. Say you have an existing sublayout control which currently caches and varys by data source.
  2. You want to update the code to also display a user-specific value as deemed by a cookie on the user's machine. The specificity of the user is now deemed to be based on this cookie.
  3. Now you also need to update the sublayout to both vary by data source and additionally, vary by the cookie key to separate them from being unique to others.

Upvotes: 1

Related Questions