The action property in the Personalization Web SDK is used to name user actions. This can include actions like viewing a page, signing up for a newsletter, logging in, etc. This property helps in tracking and sending specific actions to the Personalization system, which can then be used for analysis, targeting, and personalization.
Purpose:
The action property is used to name and capture specific user actions on the website.
Availability:
The action property is available exclusively in the Evergage namespace.
Usage:
It is typically included after the name property in the page type specification.
It helps in identifying and sending specific user interactions to the Personalization platform.
name:
"login": This is the name of the page type. It helps in identifying the page type in the Personalization system.
action:
"Login": This specifies the user action to be sent to Personalization. In this case, the action is named "Login".
isMatch:
isMatch: () => /\/login/.test(window.location.href)
This is a function that checks if the current page URL matches the /login pattern.
window.location.href: This gets the current page URL.
/\/login/.test(window.location.href): This tests if the URL contains /login.
If the URL matches, it indicates that the user is on the login page, and the "Login" action is sent to Personalization.