Virtual Pageview?

Has anyone built a function equivalent to a Google Analytics virtual pageview? Looking to essentially overwrite the URL and page title in what might otherwise be a standard pageview.

You could look at calling trackPageView whenever you are wishing to send the virtual pageview. This allows you to also set a custom title.
snowplow_name_here('trackPageView', 'custom title here');

If you’re also wanting to update the url and referrer you could call the setCustomUrl and setReferrerUrl methods before calling trackPageView

snowplow_name_here('setCustomUrl', 'http://example.com/custompage'); snowplow_name_here('setReferrerUrl', 'http://example.com/'); snowplow_name_here('trackPageView', 'custom title here');

2 Likes

Hi All, I realise this is a MEGA old thread, but bumping it may save starting a new one.

This method works fine, but I understand setCustomUrl to be sticky, meaning it persists through the entire session. I want to override the URL in a pageview just for the next page view. Is there a way this can be done, then the tracker carries on as normal afterwards?

Cheers

Hey @clicksteve

I believe if you call setCustomUrl again with an empty string, the tracker will start using the window.location again. Hope that helps :slight_smile:

You beautiful man :heart_eyes:

1 Like

:blush:

1 Like