Using The Page View API

Updated 2 years ago by Michael Alon

Aptrinsic tracks page views automatically including when installed in SPA applications. Page View API allows for programmatically tracking virtual web pages for dynamic content or in applications that does not use routing. By default the Aptrinsic track page view using document.title and document.location, it can be overridden using the following API:

aptrinsic('pageView', [pageDetailsObj])

Object can contain the following fields (non are required):






page title, this will allow to categories the page



a full URL to track (if the protocol or domain will be missing the URL will be relative to the current document.location.href)



path part of the URL, needs to start with a slash (\/)


aptrinsic("pageView", {"url" ""});

Lets say the original URL is[userId], and you do not want to track the user id on every page view. This way only the user path is tracked, alternatively you can call Aptrinsic page view with:

aptrinsic("pageView", {"path" "/user"});

This way you only overrides the path portion on the URL

Another example can be change the page title, lets say it is SPA and you want to identify dynamic content by title. You can change the title like:

aptrinsic("pageView", {"title" "update user details""path" "/userDetails"});

This way if you had a popup with user details you can also track this action with title and a specific path. In this case only URL path and title will be overridden

How did we do?

Powered by HelpDocs