Skip to main content

Page/Visit ID

Page ID

If you need a common identifier for whatever is happening on a page, you may use the usePageID hook from core.

This returns a "page ID" that changes when the route changes or the page is refreshed.

import { usePageID } from '@traveloka/core';

export default function useMerchandisingRenderer(props: Props) {
const pageId = usePageID();

useEffect(() => {
performSomeTracking({ pageId });
}, [pageId]);
}

Visit ID

Some product team defines their own "visit ID" which works a bit little differently. They store it in the localStorage so the value does not change during the lifetime/session of the current web visit.