Custom Pageviews Tracking

This is a more detailed page about how capturing page views works in Roivenue Measurement and how to customize it.

General Behavior

By default, the page_view event is captured every time on the first load of our script and every time a page_view event is being pushed into dataLayer.

  • This works fine in most scenarios - f.e. when a user makes steps in checkout process without full page reloads, you push the page_view event to dataLayer and Roivenue Measurement captures it even when the page did not change.

  • But if you have a page_view event on every page in dataLayer after page is loaded and you do not have a single page application, it will cause a duplication of page views in Roivenue. This can be easily solved by removing ‘page_view’ from event_types in the roivenue.tracking.config variable. If you then want to track additional page views, you can still do so by calling. datalayer.push({ ‘event’: ‘roivenue_measurement_event', ‘type’ : 'page_view’})

  • If you for some don’t want to track page_view automatically after page is loaded, you can disable autocapture in roivenue.measurement.config by adding: "autocapture" : false

Single Page Applications

  • If you have a single page website you need to inform us about page views by pushing page_view event into the dataLayer.

    • dataLayer.push({'event' : 'page_view'});

Last updated