Set up VIEW events
If you're using a Content SDK or JSS app, you don't need to complete with walkthrough because those apps automatically capture VIEW
events, with no coding required.
You can use the Cloud SDK events
package to capture VIEW
events. The VIEW
event tracks when the site visitor views a webpage in your web app. Because it is an essential event to track, it's important that you send VIEW
events from all webpages where you want to track site visitor behavior. In this topic, you'll start capturing events in a Next.js app that uses the App Router.
-
In your code editor, open the root folder of your web app.
-
Install and initialize the Cloud SDK and the
events
package.
Setting up VIEW
event capturing will run the pageView
function every time a webpage loads in your web app.