Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sitecore contact tracking: how does it work?

I have read through https://sitecore-community.github.io/docs/xDB/the-xdb-contact/ and https://doc.sitecore.net/sitecore_experience_platform/81/setting_up__maintaining/xdb/contacts/contact_tracking.

I would like to know whether Sitecore contact tracking will work for my client or not.

I have created a simple newsletter subscription functionality (without WFFM form submission). Once a user submits his information along with personal details and email, I send a confirmation email link. After confirming the email address, I am creating contacts through code. Thanks to Brian!

My application session state mode is InProc.

My question is, if user is interacting with the site with a new session after subscription (after submitting email):

Will Sitecore identify user as contact (and merge in existing anonymous contact) or will it create new anonymous contact each time?

I am NOT using any of the following services in my solution:

  • Device detection
  • GeoIp Service
  • FXM
like image 276
Mohit Dharmadhikari Avatar asked Sep 09 '16 03:09

Mohit Dharmadhikari


People also ask

How does Sitecore initially identify a contact?

Contact opens e-mail link sent by E-mail Experience Manager. E-mail link includes contact's alias identifier in a query string. This data is used to identify the contact.

How does Sitecore store visitor data?

On a visitors first visit to one of your channels, Sitecore creates a contact identifier and stores it on the visitor's device and in the xDB Collection database. On following visits, Sitecore reads the identifier from the visitors device and looks up any information for the contact in the xDB Collection database.

What is Sitecore contact?

In SuiteCRM a Contact is an individual who is typically associated with an Account (organisation) or Opportunity (qualified prospect). For example if Techco is the Account, then John Smith, Sales Manager of Techco is the Contact.

What is Sitecore universal tracker?

The Sitecore Universal Tracker (UT) lets you collect data from different sources as the interaction occurs and process the data when the interaction is completed. Universal Tracker version 3.0 is compatible with Sitecore XP 9.3.


1 Answers

Your approach

It seems to me that manually creating contacts is completely unnecessary in your case.

As I understand from your post, here's what happens:

  1. A user visits your website.
  2. Sitecore creates a new contact (ID: xxx).
  3. The user browses the website and submits your form.
  4. A confirmation email is sent to the user's email address.
  5. The user clicks on the link in the email and hits a confirmation page on the site.
  6. Your code creates a new contact in xDB (ID: yyy).

As a result, you have two separate contacts in xDB that are not related to each other, from Sitecore's perspective.

Now, to your question:

Will Sitecore identify user as contact (and merge in existing anonymous contact) or will it create new anonymous contact each time?

If the user is visiting from the same browser, Sitecore will recognize them as the original contact (ID: xxx) based on a cookie. Sitecore will not create a new contact in this case.

If the user is visiting from another browser or device, he will not be recognized as any of the existing contacts and a new anonymous contact will be created (ID: zzz).

As you can see, Sitecore has no way of automatically using the contact you created (ID: yyy).

Suggested solution

The only way to make Sitecore recognize a user as a specific contact is to use the identification API. In short, what you can do is this:

Sitecore.Analytics.Tracker.Current.Session.Identify(identifier);

Here's what I suggest you to do:

  • Do not create new contacts manually—there's just no need for that.
  • When the user has submitted the form, you invoke Identify() and pass the user's email address as the identifier. This will set the user's email address as the identifier of the current contact.
  • When the user comes back from the email link you sent, you invoke Identify() once again. This will make sure that, even if the user is coming from another device, the same xDB contact will be used in his session. You'll need to pass the same email address to Identify(), so make sure you have access to it—for example, you can include it in your email confirmation link as a query string parameter.
  • Use Sitecore.Analytics.Tracker.Current.Contact and populate the current contact's facets with the information you've collected about the user.
  • If you have a login functionality, remember to invoke Identify() on successful login attempts—again, this is to ensure that the same contact is used for all sessions of the same user.
like image 165
Dmytro Shevchenko Avatar answered Sep 27 '22 19:09

Dmytro Shevchenko