A Sitemap send event to Personalization based on the user actions on the website visistor. There are several ways to validate whether the Sitemap configuration correctly recognizes the target user action and sends the corresponding events.
Sitemap events are HTTP requests sent to Personalization's Event API endpoint that describes the page's context, or a specific action a user performed on the site. Examples of Sitemap events include:
Visiting a page
Viewing a catalog item
Submitting a form
Adding an item to a shopping cart
Purchasing an item
Clicking a designated page area
Event Validation Using the Sitemap Editor
Sitemap JS Tab Code Check
The Sitemap JS tab where you enter your Sitemap JavaScript has a built-in code validator that flags the presence of JavaScript syntax errors, as highlighted in the following figure.
The Logs tab provides messages related to the JavaScript code errors flagged by the Sitemap JS code editor. However, it’s advisable to use a more robust JavaScript validation tool to investigate JavaScript syntax issues and code execution errors flagged in the Sitemap JS code editor.
The following image shows the Current Page tab of the Sitemap Editor.
The Current Page tab displays all Sitemap objects configured and executed on the current page shown in the browser, including:
Page Type: Name of the configured page type of the currently displayed page
User Data: The ID of the current user browsing the page and any user-triggered events that are configured on the page. The user ID can be the user ID that is randomly generated for anonymous site visitors, or a named user ID.
Catalog Data: Names of Catalog objects configured on the current page.
Content Zones: Names of Content Zone objects configured on the current page.
DOM Listeners: Names of JavaScript DOM listeners configured on the current page.
Current Page Object Examples
The following figure shows an example of how Sitemap objects display in the Current Page tab with key functional areas indicated by numbers.
The following table lists the areas numbered on the figure and describes the purpose and function of each area.
The Page Matches tab displays the currently matched page type as well as all other page types configured in the Sitemap. The currently matched page displays with a "checkmark" icon, while the other configured page types display with a "backslash" icon to indicate they weren’t matched as the current page.
The following figure shows an example of the Page Matches tab where the home page is the currently matched page as well as several other pages that are configured in the Sitemap JS editor but aren’t matched as the current page.
The Personalization Event Stream report displays all events received by Personalization, including events sent from the Sitemap as well as from other sources.
To access the Event Stream report, do the following.
Log in to the Personalization UI.
On the Dashboard, use the dataset dropdown menu to select the dataset that contains the events you want to see.
Hover over Reports on the left menu to display the reports popup menu, and select Event Stream from the Activity section.
The Sitemap JavaScript is configured to send events to Personalization based on the actions by site visitors. This section presents an example based on an anonymous user who decides to sign up for emails from the company (thus becoming "known") and then browses the Men's section of the website.
JavaScript Listener for Email Sign-Up
The following is an example of a JavaScript listener configured to send an event when a user signs up for emails. Since the sign-up form appears on the bottom of every page on the site, ensure that you configure this listener as part of the global configuration.
SalesforceInteractions Namespace
listeners: [ SalesforceInteractions.listener("submit", ".email-signup", () => { const email = SalesforceInteractions.cashDom("#dwfrm_mcsubscribe_email").val(); if (email) { SalesforceInteractions.sendEvent({ interaction: { name: "Email Sign Up - Footer" }, user: { identities: { emailAddress: email } }, }); } }), ];
Evergage Namespace
listeners: [ Evergage.listener("submit", ".email-signup", () => { const email = Evergage.cashDom("#dwfrm_mcsubscribe_email").val(); if (email) { Evergage.sendEvent({ action: "Email Sign Up - Footer", user: { id: email }, }); } }), ];
Site UI for Email Sign-Up
The following is an example of a site email sign-up form being completed by "Joe Customer". With the JavaScript listener configured as shown in the preceding section, an event is sent to Personalization and shows up in the Event Stream when a user provides their email address and clicks the submit button (->).
Events Displayed in the Event Stream Report
If the email signup listener is properly configured in the Sitemap, when "Joe Customer" provides his email and clicks Submit, the event shows up immediately in the Personalization Event Stream report. This report provides the following information and functionality.
Event stream search
Event stream table
Event details for individual events
The following figure shows an example of the events sent to Personalization before and after Joe Customer submitted his email in the email sign-up form. The following sections describe the information and functionality provided by the Event Stream report.
Event Stream Search
In the Event Stream search area, you can search for and filter the Event Stream table to display only events that were generated by a specific user ID/user name or email address. To search through the Event Stream, do the following.
In the keyword field, enter text that matches characters in the username or email address for the user whose events you want to see.
As soon as you enter characters that match an existing username or email address, the matching username is displayed.
Click the desired user. The Event Stream table now displays only the events for that user.
If you want to see only events of a specific type, click the Event Type dropdown menu and select the desired type.
Event Stream Table
The Event Stream table lists event data for all events triggered by the Sitemap and other event sources from other systems in the Personalization integration. The data in the Event Stream table is refreshed every 15 seconds and includes the following.
Timestamp: Time or date that the event occurred. Events triggered on the current day have a timestamp of how many minutes/hours ago the event was triggered. Events triggered the day before the current day have a timestamp of "yesterday". Earlier events have a timestamp of the date the event was triggered.
User Name or Email: User name or email address of the user who triggered the event.
Action or URL: Name of the action for which the event was triggered, or the URL of the page that the user visited that triggered the event.
Modifying the Event Stream Data View
The Event Stream table provides the following functionality to modify how the data in the table displays.
Click a column heading in the Event Stream table to sort the table by the data in that field.
Click the same column heading more than one time to toggle between an ascending/descending data sort.
Click an individual event entry in the table to display the details for that event as described in the following section.
From Anonymous to Known User
The example shown in the following figure depicts what happens after "Joe Customer" submits his email address. Upon submission, the anonymous user 7ddc1195... changes to the known user joe.customer@email.com. This change happens anytime an anonymous user identifies themselves through an action like email submission or login. Personalization associates the anonymous ID with the known user and adds the browsing behavior of the anonymous ID to the Unified Customer Profile of the known user. A known user can have many associated anonymous IDs (and more than one known username) depending on their browsing habits on the site.
Individual Event Details
When you click an individual event in the Event Stream table, the details for that event are displayed in the Event Detail area to the right of the Event Stream table.
As shown in the preceding figure, the details provided in the Event Detail area for the selected individual event include:
The Event Stream table also includes the following additional fields that provide more information about a specific event, Web SDK and web page performance, and help you identify the root cause of Web SDK errors.
Sitemap developers can also validate Sitemap events using Google Chrome's built-in developer tools, as described in the following sections.
The simplest way to view events that are triggered by page load is to run the SalesforceInteractions.mcis.getSitemapResult().currentPage command (or Evergage.getCurrentPage in the Evergage namespace) from the Chrome Console developer panel. However, this command will not display events that are triggered after page load. To run this command, do the following:
Exit the Personalization Sitemap Editor.
Navigate to the site page containing the events you want to validate.
Open Chrome Developer Tools and navigate to the Console panel.
Depending on the namespace being used, run the following command.
SalesforceInteractions Namespace
SalesforceInteractions.mcis.getSitemapResult().currentPage;
Evergage Namespace
Evergage.getCurrentPage();
The following figure shows an example of the results of running the SalesforceInteractions.getSitemapResult().currentPage command.
The following figure shows an example of the results of running the Evergage.getCurrentPage command.
In the Chrome Network developer panel, you can see all events generated on the current page, including those events generated after page load. To view all events generated on the current page, do the following.
Exit the Personalization Sitemap Editor.
Navigate to the site page containing the events you want to validate.
Perform an action on the page that you expect to generate an event.
Open the Chrome Developer Tools and navigate to the Network panel.
Find and select the event. The event contains the name of your dataset followed by a question mark (?) and the word "event".
Select the event and select the Headers panel to view the event. Events are sent from the Sitemap to Personalization as JSON GET requests. The events are converted to Base64 and appended to the request URL, as shown in the following figure.
Copy the event GET request starting immediately after event= to the end, as highlighted in the following figure.
Navigate to the Chrome Console developer tool. Run the atob command to convert the event back to JavaScript objects. You can run the JSON.parse command in combination with the atob command to return the event JavaScript formatted. The syntax for running this command is as follows:
JSON.parse(atob("<Event text in Base 64>"));
The following figure shows an example of running the atob command in the SalesforceInteractions namespace and the results returned.