Solved

How do I track first page view?

  • 18 April 2022
  • 2 replies
  • 2842 views

Badge

We currently track page views on our website (ie every time a user lands on a page we fire an amplitude event with relevant page data like url, title, etc). 

 

We want to also be able to track the first page visited, meaning we want to know what page a completely new user lands on first.

 

Is there any suggested way of doing that via Amplitude?

 

Thanks! 

icon

Best answer by SheenaGreen 19 April 2022, 19:20

View original

2 replies

Userlevel 4
Badge +8

Hi @veshei,

 

One idea that comes to mind is setting a user property that contains the page info along with your page view event. You could use setOnce so the user property is not overwritten upon subsequent page view event fires. Here’s more info on setting user properties via the JS SDK.

 

 

Badge

Thanks @SheenaGreen for the tip! That seems to work.

 

Only weird thing is that the $identify function that calls setOnce still shows up in the amplitude extension on every route change (which is what page view does). But in amplitude itself the first value logged by setOnce is the one that it is set to. Took me a bit to realize the extension wasn’t showing the setOnce properly! 

Reply