Using the Privacy JavaScript library
Learn how to use the Privacy JavaScript library to gather customer identities in your application before sending them to Privacy Service. For example, learn how to set up the tag extension in Data Collection (formerly, Launch). For more information, please visit the Privacy Services documentation.
Transcript
When a customer or data subject requests to access or delete their stored personal data, the first step is to gather the data subject’s identities before sending them to Adobe Experience Platform Privacy Service. Adobe provides a JavaScript library that allows you to automate the process of gathering customer identities on the client side of your website or mobile application. After installing and integrating the library into your app or website, you can set up additional protocols to handle the gathered identity data how you like, including sending those identities to the Privacy Service API for processing. In this video, we’ll go through the process of setting up the Privacy JavaScript library and how to use it to gather customer identity data. To start using the library, you must first install it on your website or mobile app. There are a few ways to do this. You can install the library using a bash command if you’re using npm, or you could download the library directly from the Experience Cloud GitHub repository. For this demo though, we’ll go through the steps of installing the library using a data collection tag extension. For more information on the other implementation methods, please refer to the documentation. We’ll start by logging into the data collection UI. We’ll be configuring the library for a website in this demo, so we’ll open the property for our web application here. Next, we’ll select Publishing Flow in the left navigation, and we’re given a view of the libraries that we have published in our different environments. Since we want to test the privacy extension in our development environment, we’ll create a new library. Select Add Library. We’ll call this library Privacy, and we’ll assign it to the development environment. We’ll save and build the development for now. Once the library is created, we’ll select it as our working library using the dropdown menu on the top right of the screen. With our library selected, we’ll head over to the Extensions section. Switching over to the Catalog tab, we can see the available extensions we can install and use the search bar to find Adobe Privacy from the list. Select Install, and we’re brought to the installation page for the extension. From here, we can configure the extension, so it knows where to pull identity data from. Depending on the Experience Cloud solutions you’re using to collect personal data, different configuration options will need to be set on this page. Since we’ll be making privacy requests for Adobe Analytics and Audience Manager, we’ll select them from the list. We also want the extension to gather any Experience Cloud visitor IDs, so we’ll select Visitor as well. We’ll hit Update, and the Properties section now shows that we’re required to provide additional information. Specifically, we need to provide our IMS organization ID for Experience Cloud visitor identities and the ID of the report suite that we’re using to track customer activities in Analytics. If there are other optional configuration properties that we can use, we can select them using the dropdown menu. In our case, we want to provide the name of our tracking cookie for Audience Manager. For more information on solution-specific configuration parameters, please refer to the documentation. Once we’re done configuring the extension, we’ll select Save to Library to add it to our working library. Now when we go back to the Publish Flow tab, we can see that our development library requires a new build before we can deploy it on our website. So we’ll select the ellipse icon and choose Build to Development from the dropdown menu. After a moment, our build is complete and we’re ready to deploy it to our website. Select Environments in the left nav. For the development environment, select the small icon on the right and a dialog appears with installation instructions. Since we’re working on a web property, we’re given an HTML script tag that we can place in the head tag of our website. If we’re working on a mobile property, we would be shown different instructions here. Once we’ve installed the build in our development environment, the next step is to create a rule that will utilize the Adobe Privacy extension. Specifically, we’re going to use the extension Retrieve identities function. This function retrieves all the available identities for a customer and passes them to a callback function that we define, letting us handle the identity data however we like. Before we build the rule, we first need to create a data element that will act as our callback function. So we’ll go to the Data Elements tab and select Add Data Element. We’ll call this data element HandleRetrievedIds and we’ll select Core for the extension. Under Data Element Type, we’ll choose Custom Code. The right panel updates and now we can select Open Editor to define our callback function. We’ll define a single JavaScript function that’ll handle the IDs returned by our Privacy extension. The function requires a name, so we’ll call ours RuleAction. The function accepts one argument, which we’ll call IDs. When the Privacy extension gathers customer identities, it passes the identities to a single object in this callback function. From here, we can define what we want to do with the IDs object after the Privacy extension retrieves it. If we are testing our implementation, we can use a simple Console.log statement so we can see what IDs are being retrieved in the browser. We can also access any globally accessible functions or variables on our website or app. For example, if we defined a function that accepts customer IDs and sends privacy requests to the Privacy Service API, we can directly invoke it here. Details on how to format requests to the Privacy Service API are provided in a later video. Once we’re satisfied with our callback, we’ll select Save, then Save to Library. We can now see our new HandleRetrievedIDs data element in the list. Now that we’ve defined our callback, we’re ready to make a rule. Select Rules in the left nav, then select Add Rule. To start, we need to give the rule a name. We’ll call this rule Retrieve identities. Next, we need to specify the events or conditions that will cause this rule to fire. In our case, we want to retrieve identity data when a customer submits a privacy form on our website. So under Events, we’ll select Add. On the next page, we’ll select the core extension, and under Event Types, we’ll select the Form Submit Event. The right panel updates and we’re given some extra options to configure the event. In our case, we want to target a specific element, since we only want this rule to fire on our privacy form. In order to specify this form, we must provide the unique CSS selector in the element as it appears on our website. We’ll select Keep Changes, and we can see that our event has now been added to the rule. Now whenever a privacy form is submitted on our site, this rule will trigger. Finally, we need to give this rule an action to perform whenever it gets triggered. Specifically, we want to invoke the Privacy JavaScript library to retrieve customer identity data. Under Actions, we’ll select Add. We’ll select Adobe Privacy for the extension, and for Action Type, we’ll choose Retrieve identities. We’re prompted to provide a data element that will serve as the callback for the retrieve identities function. We’ll select our HandleRetrievedIds data element that we created earlier. With our data element added, we’ll select Keep Changes to add this action to the rule, and then we’ll save it to the library. Now that we’ve created our rule, the final step is to build the library to an environment. Since we know that our working library is assigned to the development environment, we’ll select Build on the top right of the screen. And that’s it. To build the successful, we can dive into our web or mobile application and verify whether our implementation is working as expected when we submit our privacy form. By watching this video, you should now have a better understanding of how to install the Adobe Privacy extension, how to create a rule that gathers customer IDs, and how to handle those IDs in a callback function. To learn how to send these IDs to Privacy Service, please refer to the video tutorials on formatting privacy requests or the official Privacy Service documentation. Thanks for watching.
recommendation-more-help
9051d869-e959-46c8-8c52-f0759cee3763