nsc_Visitor.getVisitedPages()

Returns the object array of all pages seen during the current visit. The pages are ranked chronologically. This means that the fist element is the landing page while the last one is the current page.

Object structure in array

PropertyTypeDescription
href String Page full URL
search String Request string parameters for the page.
pathname String Relative pathname on the site (without domain name)
start Integer Date and time of page entrance. Presented as the number of milliseconds that have passed since the midnight of January 1, 1970 GMT
end Integer Date and time of page leaving. Presented as the number of milliseconds that have passed since the midnight of January 1, 1970 GMT
title String Page title.
time Integer Time spent by the user on the page. In seconds

Use-case

/* Testing whether the visitor has been to the /testpage/ of our website */

$(function() {
    // Adding the listener of the chat widget initialization event
    // Up to this moment the nsc_Visitor object is lacking in the context
    $(document).on('netroxinit', function(event, data) {
        if (!data.real) { // Not status change but initialization with any status upon page loading
            var pages = nsc_Visitor.getVisitedPages(),
                visited = false;
            for (var i = 0; i < pages.length; i++) {
                var testPage = pages[i];
                if (testPage.pathname.indexOf("testpage") != -1) {
                    visited = true;
                    break;
                }
            }
        }
    });
});

All rights reserved. Copyright © 2017 Netrox SC
Host CMS