Expand my Community achievements bar.

How to capture the first landing page url value?

Avatar

Level 2

Hi all,

 

I'm trying to migrate app mesurement to websdk but facing a question about how set a first landing page value to prop1 (report for hit based).

 

Due to the s variable is not able to use anymore in websdk.

 

Do you have any idea?

 

Thank you.
Lemen 

7 Replies

Avatar

Community Advisor

How did you use to do it with AppMeasurement?

Avatar

Level 2

Hi yuhuisg,

 

I'm using the plugin - getVisitStart and set the pagename if the visit is equal 1. If this function is not available, I have no idea about how to capture the pagename to prop1. Core - Landing page is able to set the first landing URL, but it will be send to server every pageview call. Just wonder that how to set and send it when the first visit + first hit. Thank you! 

 

if(s.getVisitStart('s_visit')==1){s.prop1=s.pageName;}
 
/* Plugin: getVisitStart v2.1 - return 1 on start of visit, else 0 */
s.getVisitStart=new Function("c",""
+"var s=this,n,t=new Date;if(typeof s.callType=='function'&&s.callTyp"
+"e()=='+')return 0;if(!c)c='s_visit';t.setTime(t.getTime()+18e5);n=s"
+".c_r(c)?0:1;if(!s.c_w(c,1,t))s.c_w(c,1,0);if(!s.c_r(c))n=0;return n");
 
Regards,
Lemen

Avatar

Community Advisor

Unfortunately, I don't think there's an equivalent of this plugin for WebSDK. But maybe you can replicate it on your own.

Basically, every time the plugin is called, it does these 3 steps:

  1. First, it tries to read the cookie (which, by default, is called "s_visit"). If it can read this cookie, it remembers the value "0", otherwise, it remembers the value "1".
  2. Then, it writes the cookie to expire 30 minutes from now.
  3. Finally, it returns the remembered value.

The key phrase above is "every time". That's right, with every hit, it extends the cookie's expiry to be 30 minutes from now -- because that is Adobe Analytics' definition of a visit:  a series of hits with no break of more than 30 minutes.

So, if you can replicate the above logic, then you should be able to use the returned "1" or "0" value to set your prop1. You could do this in 1 of 2 ways:

  • Put your replicated code inside WebSDK's "onBeforeEventSend" function, or
  • With 2 resources:
    1. A data element to read the cookie and return 1 or 0.
    2. A rule that gets fired every time you send a WebSDK hit to write the cookie.

Hope that works. I haven't tried it myself, so please test this extensively on your own to validate.

Avatar

Level 10

If you really need to put first page-first visit into a variable, setting some launch rules is probably your best approach. You can use a processing rule to set the first page of a visit into a variable, but I'm pretty sure visit number is not available in processing rules (though that would be nice to have).

On the other hand, if you just need to identify first page-first visit pages, you can use a segment. Something like this should work:

RobertBlakeley_1-1712524739217.png

Page Depth uses a counter evar configuration to count how many pages into a visit the page view occurred. That configuration looks like this:

RobertBlakeley_3-1712524922955.png

Avatar

Level 2

Hi RobertBlakeley ,

 

Thank you for your reply. I'm also trying to use the Core - Session Count Page View, but seem the default session is over 30min. If it is work, I can use this count for First Visit First Page capture.

 

Thank you.

Regards,

Lemen

Avatar

Community Advisor

Similar to @RobertBlakeley solution, Adobe should be tracking both Visit Number and Hit Depth automatically. So you should be able to build a segment to get a user's first ever landing page by using:

 

Jennifer_Dungan_0-1712582118957.png

 

 

If you only care about the first page of a Visit, which I believe that plugin would return, then you should just be able to use:

Jennifer_Dungan_1-1712582199675.png

 

 

  • Visit Number is an all-time counter of a known user's visits. 
  • Hit Depth is a per visit counter of the number of hits that a user has made within each
    • note that IF the first hit of a visit is an action and not a page view, that is what information will be returned

 

At least this solution shouldn't require using creating a new counter.