Track page views

Apply the following procedure if you want to log all visits to pages residing in your web site in the contact journey

To be identified, visitors should have already clicked on a link hook before visiting your web page.

Adding analytics script to your site

Add the following code to your site's templates.

The code should be added near the top of the tag, before any other script or CSS tags.

<script src="https://static.stnt.co/analytics.min.js"></script>

Page view tracking

Page view hits can be sent using the track command and specifying a hitType of page-view.

The track command has the following signature:

stnt.track('trackingId', 'hitType', 'pageUrl');

Track fields

The following table summarizes the primary fields relevant to tracking page views.

Field

Data type

Required

Description

trackingId

String

Yes

Your tracking ID. Should look like STNT-XXXXXXXXXX-Y

hitType

String

Yes

The type of hit. Page view hit should be page-view

pageUrl

String

Yes

URL of the page being tracked. Can be absolute or relative.

Example

The following command sends a page-view hit and includes the path of the current page:

stnt.track('STNT-XXXXXXXXXX-Y', 'page-view', document.location.href);