Show Menu
TOPICS×

Add the Adobe Experience Platform Identity Service

This lesson will guide your through the steps required to implement the Adobe Experience Platform Identity Service extension and send customer ids.
The Adobe Experience Platform Identity Service sets a common visitor id across all Adobe solutions in order to power Experience Cloud capabilities such as audience-sharing between solutions. You can also send your own customer ids to the Service to enable cross-device targeting and integrations with your Customer Relationship Management (CRM) system.

Learning Objectives

At the end of this lesson, you will be able to:
  • Add the Identity Service extension
  • Create a data element to collect your customer ids
  • Create a rule that uses the "Set Customer IDs" action to send the customer ids to Adobe
  • Use the rule ordering feature to sequence rules that fire on the same event

Prerequisites

You should have already completed the lessons in the Configure Launch section.

Add the Identity Service Extension

Since this is the first extension you are adding, here is a quick overview of extensions. Extensions are one of the core features of Launch. An extension is an integration built by Adobe, an Adobe partner, or any Adobe customer that adds new and endless options for the tags that you can deploy to your website. If you think of Launch as an operating system, extensions are the apps that you install so Launch can do the things you need it to do.
To add the Identity Service Extension
  1. In the top navigation, click Extensions
  2. Click Catalog to go to the Extensions Catalog page
  3. Note the variety of extensions that are available in the Catalog
  4. In the filter at the top, type "id" to filter the Catalog
  5. On the card for the Adobe Experience Platform Identity Service, click Install
  6. Note that your Experience Cloud Organization ID has been auto-detected for you.
  7. Leave all of the default settings and click Save to Library and Build
Each version of the Identity Service extension comes with a specific version of VisitorAPI.js which is noted in the extension description. You update the VisitorAPI.js version by updating the Identity Service extension.

Validate the Extension

The Identity Service extension is one of the few Launch extensions that makes a request without having to use a rule action. The extension will automatically make a request to the Identity Service on the first page load of the first visit to a website. Once the ID has been requested, it will be stored in a first party cookie beginning with "AMCV_".
To validate the Identity Service extension
  1. Open the Luma site
  2. Make sure the Debugger is mapping the Launch property to your Development environment, as described in the earlier lesson .
  3. On the Summary tab of the Debugger, the Launch section should indicate that the Adobe Experience Platform Identity Service extension is implemented.
  4. Also, on the Summary tab, the Identity Service section should populate with the same Org ID that was on your extension configuration screen in the Launch interface:
  5. The initial request to retrieve the Visitor ID might appear in the Identity Service tab of the Debugger. It might have already been requested, though, so don't worry if you don't see it:
  6. After the initial request to fetch the Visitor ID, the ID is stored in a cookie whose name begins with AMCV_ . You can confirm that the cookie has been set by doing the following:
    1. Open your browser's Developer Tools
    2. Go to the Application tab
    3. Expand Cookies on the left side
    4. Click on the domain https://aem.enablementadobe.com
    5. Look for the AMCV_ cookie on the right hand side. You might see several since have loaded the Luma site using both it's hardcoded Launch property as well as mapped to your own.
That's it! You've added your first extension! For more details on the configuration options of the Identity Service, see the documentation .

Send Customer IDs

Next, you will send a Customer ID to the Identity Service. This will allow you to integrate your CRM with the Experience Cloud as well as track visitors across devices.
In the earlier lesson, Add Data Elements, Rules, and Libraries you created a data element and used it in a rule. Now, you will use those same techniques to send a Customer ID when the visitor is authenticated.

Create Data Elements for Customer IDs

Start by creating two data elements:
  1. Authentication State —to capture whether or not the visitor is logged in
  2. Email (Hashed) —to capture the hashed version of the email address (used as the customer ID) from the data layer
To create the data element for Authentication State
  1. Click Data Elements in the top navigation
  2. Click the Add Data Element button
  3. Name the data element Authentication State
  4. For the Data Element Type , select Custom Code
  5. Click the Open Editor button
  6. In the Edit Code window, use the following code to return values of "logged in" or "logged out" based on an attribute in the Luma site's data layer:
    if (digitalData.user[0].profile[0].attributes.loggedIn)
        return "logged in"
    else
        return "logged out"
    
    
  7. Click Save to save the custom code
  8. Leave all of the other settings on their default values
  9. Click Save to Library and Build to save the data element and return to the data elements page
By knowing the authentication state of the user, you know when a customer id should exist on the page to send to the Identity Service. The next step is to create a data element for the customer id itself. On the Luma demo site, you will use the hashed version of the visitor's email address.
To add the data element for the hashed email
  1. Click the Add Data Element button
  2. Name the data element Email (Hashed)
  3. For the Data Element Type , select JavaScript Variable
  4. As the JavaScript variable name , use the following pointer to a variable in the Luma site's data layer: digitalData.user.0.profile.0.attributes.username
  5. Leave all of the other settings on their default values
  6. Click Save to Library and Build to save the data element

Add a Rule to Send the Customer IDs

The Adobe Experience Platform Identity Service passes the Customer IDs in rules using an action called “Set Customer IDs.” You will now create a rule to trigger this action when the visitor is authenticated.
To create a rule to send the Customer IDs
  1. In the top navigation, click Rules
  2. Click Add Rule to open the Rule Builder
  3. Name the rule All Pages - Library Loaded - Authenticated - 10
    This naming convention indicates you are firing this rule at the top of all pages when the user is authenticated and it will have an order of “10”. Using a naming convention like this—instead of naming it for the solutions triggered in the actions—will allow you to minimize the overall number of rules needed by your implementation.
  4. Under Events click Add
    1. For the Event Type select Library Loaded (Page Top)
    2. For the Order enter 10 . The Order controls the sequence of rules that are triggered by the same event. Rules with a lower order will fire before rules with a higher order. In this case, you want to set the customer ID before you fire the Target request, which you will do in the next lesson with a rule with an order of 50 .
    3. Click the Keep Changes button to return to the Rule Builder
  5. Under Conditions click Add
    1. For the Condition Type select Value Comparison
    2. Click the icon to open the Data Element modal
    3. In the Data Element Modal, click on Authentication State and then click Select
  6. Make sure Equals is the operator
  7. Type "logged in" in the text field, causing the rule to fire whenever the Data Element “Authentication State” has a value of “logged in”
  8. Click Keep Changes
  9. Under Actions click Add
    1. For the Extension select Adobe Experience Platform Identity Service
    2. For the Action Type select Set Customer IDs
    3. For the Integration Code enter crm_id
    4. For the Value enter open the Data Element selector modal and select the Email (Hashed)
    5. For the Auth State select Authenticated
    6. Click the Keep Changes button to save the action and return to the Rule Builder
  10. Click the Save to Library and Build button to save the rule
You've now created a rule that will send the Customer ID as a variable crm_id when the visitor is Authenticated. Since you specified the Order as 10 this rule will fire before your All Pages - Library Loaded rule created in the Add Data Elements, Rules and Libraries lesson which uses the default Order value of 50 .

Validate the Customer IDs

To validate your work, you will log into the Luma site to confirm the behavior of the new rule.
To log into the Luma site
  1. Open the Luma site
  2. Make sure the Debugger is mapping the Launch property to your Development environment, as described in the earlier lesson
  3. Click the LOGIN link in the top right corner of the Luma site
  4. Enter test@adobe.com as the username
  5. Enter test as the password
  6. Click the LOGIN button
  7. Return to the Homepage
Now, confirm the customer id is sent to the Service using the Debugger extension.
To validate that the Identity Service is passing the customer id
  1. Make sure the tab with the Luma site is in focus
  2. In the Debugger, go to the Adobe Experience Platform Identity Service tab
  3. Expand your Org ID
  4. Click on the cell with the Customer ID - crm_id value
  5. In the modal, note the customer id value and that the AUTHENTICATED state is reflected:
  6. Note that you can confirm the hashed email value by viewing the source code of the Luma page and looking at the username property. It should match the value you see in the Debugger:

Additional Validation Tips

Launch also has rich console logging features. To turn them on, go to the Tools tab in the Debugger and turn on the Launch Console Logging toggle.
This will turn on console logging both in your browser console and in the Logs tab of the Debugger. You should see the logging of all of the rules you have created so far! Note that new log entries are added to the top of the list, so your rule "All Pages - Library Loaded - Authenticated - 10" should fire before the "All Pages - Library Loaded" rule and appear below it in the Debugger's Console Logging: