Skip to content

Latest commit

 

History

History
30 lines (23 loc) · 739 Bytes

File metadata and controls

30 lines (23 loc) · 739 Bytes
layout api_prebidjs
title pbjs.refreshPageViewId
description
sidebarType 1

Refreshes the previously generated page view ID. Can be used to instruct bidders that use page view ID to consider future auctions as part of a new page load.

// Function to call when the URL changes
function onUrlChange() {
    pbjs.refreshPageViewId();
}

// Function to initialize the URL change listener
function initUrlChangeListener() {
    // Listen for changes to the history state
    window.addEventListener('popstate', onUrlChange);

    // Optionally, you might want to handle the initial load as well
    onUrlChange();
}

// Call the function to set up the listener
initUrlChangeListener();