---
schema_version: "1"
id: b47c50958c36406e95ad1e1208358a09a7a042ea30db131ca5bfa6092b324fb3
title: Merging Logic in the Salesforce Interactions SDK
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/mktg/264-0-0/mc_pers_identity_web_sdk_merging_logic.md
canonical_url: https://help.salesforce.com/s/articleView?id=mktg.mc_pers_identity_web_sdk_merging_logic.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: c2af97fbc7552a967fb941052eb5f28d4553037397b514ff29120dead92d23e9
description: One of Personalization’s key goals is to identify each of your customers with a Unified Customer Profile so that you can provide unique personalized experiences. However, as users engage with your various channels, it’s possible to end up with multiple user profiles for the same person. The Marketing Cloud Personalization module of the Salesforce Interactions SDK supports anonymous and named user profiles by using a first-party cookie to track user behavior on your website. A user profile can transition from anonymous to named based on the setup of the identity types in your Salesforce Interactions SDK.
products:
  - Marketing
  - Salesforce Personalization
release: "264"
---
# Merging Logic in the Salesforce Interactions SDK

One of Personalization’s key goals is to identify each of your customers with a Unified Customer Profile so that you can provide unique personalized experiences. However, as users engage with your various channels, it’s possible to end up with multiple user profiles for the same person. The Marketing Cloud Personalization module of the Salesforce Interactions SDK supports anonymous and named user profiles by using a first-party cookie to track user behavior on your website. A user profile can transition from anonymous to named based on the setup of the identity types in your Salesforce Interactions SDK.

## Anonymous User Profiles

The Marketing Cloud Personalization module of the Salesforce Interactions SDK generates an anonymous ID for all events, but assigns an anonymous ID for the user’s identity on the visitor’s initial visit, and only when the event contains no identity types. Once assigned, the anonymous ID remains associated with that visitor and browser until explicitly removed or timed out. For anonymous events, Personalization uses its anonymous ID to determine whether the events match the anonymous IDs of any existing user profiles, or whether a new user generated the event.

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small ">
        <colgroup>
          <col style="width:33.33333333333333%">
          <col style="width:33.33333333333333%">
          <col style="width:33.33333333333333%">
        </colgroup>
        <thead class="slds-text-title_caps ">
          <tr class="">
            <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d72381e46">Example Scenarios</th>
            <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d72381e49">Analysis</th>
            <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d72381e52">Resolution</th>
          </tr>
        </thead>
        <tbody>
          <tr class="">
            <td data-label="Example Scenarios" class="slds-cell-wrap" style="vertical-align:top;" headers="d72381e46 ">
              <p>An organization is using the Email Address identity type in its Web
                SDK.</p>
              <p style="margin-bottom:0;">Personalization receives a page view event from a visitor without an
                email address.</p>
            </td>

            <td data-label="Analysis" class="slds-cell-wrap" style="vertical-align:top;" headers="d72381e49 ">The event doesn’t contain an anonymous ID.</td>

            <td data-label="Resolution" class="slds-cell-wrap" style="vertical-align:top;" headers="d72381e52 ">The identity system assigns the website visitor an
              anonymous ID. Personalization creates a new anonymous user profile, and
              assigns the event data to that profile.</td>

          </tr>
          <tr class="">
            <td data-label="Example Scenarios" class="slds-cell-wrap" style="vertical-align:top;" headers="d72381e46 ">
              <p>An organization is using the Email Address identity type in its Web
                SDK.</p>
              <p style="margin-bottom:0;">Personalization receives a page view event from a visitor without an
                email address.</p>
            </td>

            <td data-label="Analysis" class="slds-cell-wrap" style="vertical-align:top;" headers="d72381e49 ">The event contains an anonymous ID that matches an existing
              anonymous user profile.</td>

            <td data-label="Resolution" class="slds-cell-wrap" style="vertical-align:top;" headers="d72381e52 ">Personalization recognizes that the event is from a
              returning anonymous user and assigns the event to that user’s
              profile.</td>

          </tr>
        </tbody>
      </table>

## Named User Profiles

If one or more identity types are present in a web event, Personalization considers it a named event. Personalization uses the identity types to either assign that event to an existing user profile or create a user profile for it. An anonymous profile can become a named profile through this identity lookup and merging process.

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small ">
        <colgroup>
          <col style="width:33.33333333333333%">
          <col style="width:33.33333333333333%">
          <col style="width:33.33333333333333%">
        </colgroup>
        <thead class="slds-text-title_caps ">
          <tr class="">
            <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d72381e121">Example Scenarios</th>
            <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d72381e124">Analysis</th>
            <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d72381e127">Resolution</th>
          </tr>
        </thead>
        <tbody>
          <tr class="">
            <td data-label="Example Scenarios" class="slds-cell-wrap" style="vertical-align:top;" headers="d72381e121 ">
              <p>An organization is using the Email Address identity type in its Web
                SDK.</p>
              <p style="margin-bottom:0;">Personalization receives a page view event that contains an email address
                value.</p>
            </td>

            <td data-label="Analysis" class="slds-cell-wrap" style="vertical-align:top;" headers="d72381e124 ">The email address value doesn’t match any existing user
              profiles. However, the anonymous ID of the event matches the ID of an
              existing anonymous user profile.</td>

            <td data-label="Resolution" class="slds-cell-wrap" style="vertical-align:top;" headers="d72381e127 ">Personalization assigns the event data to the existing
              anonymous user profile. The event’s email address value changes the
              anonymous user profile to a named user profile.</td>

          </tr>
          <tr class="">
            <td data-label="Example Scenarios" class="slds-cell-wrap" style="vertical-align:top;" headers="d72381e121 ">
              <p>An organization is using the Email Address identity type in its Web
                SDK.</p>
              <p style="margin-bottom:0;">Personalization receives a page view event that contains an email address
                value.</p>
            </td>

            <td data-label="Analysis" class="slds-cell-wrap" style="vertical-align:top;" headers="d72381e124 ">The email address value matches an existing named user
              profile.</td>

            <td data-label="Resolution" class="slds-cell-wrap" style="vertical-align:top;" headers="d72381e127 ">Personalization assigns the event to the existing named
              user profile.</td>

          </tr>
          <tr class="">
            <td data-label="Example Scenarios" class="slds-cell-wrap" style="vertical-align:top;" headers="d72381e121 ">
              <p style="margin-bottom:0;">Personalization receives an event from the Internet with two identity
                types: Email Address and Customer ID.</p>
            </td>

            <td data-label="Analysis" class="slds-cell-wrap" style="vertical-align:top;" headers="d72381e124 ">
              <p>Two user profiles exist with identifiers that match the
                ones in the event. One profile has a matching email address and the other
                profile has a matching customer ID.</p>
              <p style="margin-bottom:0;">In the user profile with the matching
                customer ID, the email address isn’t the same as the Email Address value
                in the event.</p>
            </td>

            <td data-label="Resolution" class="slds-cell-wrap" style="vertical-align:top;" headers="d72381e127 ">Personalization merges the two existing user profiles.
              Because the email address from the incoming event has the latest timestamp,
              Personalization retains that email address.</td>

          </tr>
        </tbody>
      </table>

## User Profiles from Different Devices

Personalization can merge multiple user profiles that result from the same individual using different devices. For example, if a person visits your website from a desktop computer and from a mobile device, that individual has two anonymous IDs. Personalization tracks their behavior in two separate anonymous user profiles. When a named event occurs on each device, like a login or a purchase, the anonymous user profiles become named user profiles and have a matching identity. Personalization can then merge the two named user profiles into a unified customer profile and combines their histories.

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small ">
        <colgroup>
          <col style="width:33.33333333333333%">
          <col style="width:33.33333333333333%">
          <col style="width:33.33333333333333%">
        </colgroup>
        <thead class="slds-text-title_caps ">
          <tr class="">
            <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d72381e213">Example Scenario</th>
            <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d72381e216">Analysis</th>
            <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d72381e219">Resolution</th>
          </tr>
        </thead>
        <tbody>
          <tr class="">
            <td data-label="Example Scenario" class="slds-cell-wrap" style="vertical-align:top;" headers="d72381e213 ">
              <p>An organization is using the Email Address identity type in its Web SDK.
                A user visits their website from a desktop computer, and Personalization
                assigns them an anonymous ID.</p>
              <p>Later, the same person visits the website from a mobile device, and
                Personalization assigns them a second anonymous ID.</p>
              <p style="margin-bottom:0;">The visitor then completes a login action from the desktop computer and
                from their mobile device.</p>
            </td>

            <td data-label="Analysis" class="slds-cell-wrap" style="vertical-align:top;" headers="d72381e216 ">When the visitor completes a login action from each device
              assigned an anonymous ID, Personalization captures the email address and
              sends it with the login events from each device.</td>

            <td data-label="Resolution" class="slds-cell-wrap" style="vertical-align:top;" headers="d72381e219 ">Personalization uses the Email Address value to merge both
              anonymous user profiles into a single named user profile with the combined
              behavioral history from both user profiles.</td>

          </tr>
        </tbody>
      </table>