Newer Version Available

This content describes an older version of this product. View Latest

Manage Data in LWR Sites

Use this guide to understand how visitor engagement from your LWR sites can be sent to Data Cloud and how you can best tailor our tools to your specific needs. Data is a powerful tool in the world of site management and analytics. Understanding how your users interact with your sites helps you build detailed user profiles, create enhanced analytics, and personalize your site for the best user experience.

Familiarize Yourself with Data Cloud

If you’re unfamiliar with Data Cloud, take some time to explore Data Cloud Help.

Turn On Data Cloud for Your Site

The Experience Cloud integration with Data Cloud automatically performs most of the setup needed for you to get started. Before you get started, perform the tasks described in Connect Data Cloud to Your LWR Sites in Salesforce Help.

Learn About the Experience Data Layer

A data layer contains all the information captured when a user interacts with your website. The data layer is embedded as JSON in the HTML of your website. It provides a central location for user data so it can be sent to other applications and processed. The Experience Data Layer contains information about the page, the user, and behavioral data from your Experience Cloud sites. All of that data provides valuable information about how your customers interact with your site and can be sent along to other apps like Data Cloud and Google Analytics, or power products like Marketing Cloud.

Use the Experience Data Layer Object Lightning web component to populate the data layer.

Note

Experience Data Layer Code with Embedded JSON

1<html>
2    <head>
3    </head>
4    <body>
5        <web-runtime-app>
6            <experience-data-layer-object>
7                <script type="application/json" data-provider-type="site">
8                    {
9                        "siteId": "site-12345"
10                    }
11                </script>
12            </experience-data-layer-object>
13            <experience-data-layer-object>
14                <script type="application/json" data-provider-type="page">
15                    {
16                        "url": "https://www.datacloud.salesforce.com",
17                        "urlReferrer": "https://www.root.salesforce.com"
18                    }
19                </script>
20            </experience-data-layer-object>
21            <experience-data-layer-object>
22                <script type="application/json" data-provider-type="user">
23                    {
24                        "guestUuid": "guest-uuid-12345",
25                        "crmId": "user-id-12345"
26                    }
27                </script>
28            </experience-data-layer-object>
29            <commerce-product-list-component>
30                <commerce-product-list-data-provider>
31                    <experience-data-layer-object>
32                        <script type="application/json" data-provider-type="catalog">
33                            [
34                                {
35                                    "id": "product-id-12345",
36                                    "type": "Product",
37                                    "attributes": {
38                                        "color": "blue"
39                                    }
40                                },
41                                {
42                                    "id": "product-id-54321",
43                                    "type": "Product",
44                                    "attributes": {
45                                        "color": "orange"
46                                    }
47                                }
48                            ]
49                        </script>
50                    </experience-data-layer-object>
51                </commerce-product-list-data-provider>
52                    <div>
53                        <p>Product-1</p>
54                    </div>
55                <commerce-individual-product-component>
56                </commerce-individual-product-component>
57                    <div>
58                        <p>Product-2</p>
59                    </div>
60                <commerce-individual-product-component>
61                </commerce-individual-product-component>
62            </commerce-product-list-component>
63        </web-runtime-app>
64    </body>
65</html>