Whereas in the past there were different functions to distinguish between a page view and a link (for example, s.t(), s.tl()
), in the Web SDK there is just the sendEvent
command. The data you send with an event determines whether it should be a page view or a link. Learn more about tracking links.
You can specify a page view by setting the the web.webPageDetails.pageViews.value=1
variable.
alloy("sendEvent", {
"xdm": {
"web": {
"webPageDetails": {
"pageViews": {
"value":1
}
}
}
}
});
Although Analytics technically records a page view even if this variable is not set, it is a best practice to set this variable whenever you want to record a page view to be explicit in your data and to future proof your implementation.