getVisitStart SiteCatalyst Plug-in

The getVisitStart plug-in is used to determine first page of a visit. It returns 1 on the first plug-in call of the visit, otherwise returns nothing. It uses a 30 minute cookie if possible, otherwise reverts to a session cookie. It always returns 0 if 30 minute or session cookie can’t be set.

Plug-in Prototype
s.getVisitStart(c)

Parameter Descriptions
c=cookie name for tracking (“s_visit” is standard)

Example
Here is an example use of the plug-in to populate a s.prop variable with a value on the first page of the visit.

s.prop1=s.getVisitStart("s_visit");

This would return 1 on the first page of the visit, nothing all the remaining pages.

Let’s say on the first page view of a visit you want to set an event and capture the URL in a prop. You could use this plug-in like this to accomplish that.

s.visEvent=s.getVisitStart("s_visit");
if (s.visEvent) {
s.events=s.apl(s.events,'event1',',',1); 
s.prop1=document.location.href;	
}

Code

/*
 * Get visit start
 */
s.getVisitStart=new Function("c",""
+"var s=this,v=1,t=new Date;t.setTime(t.getTime()+1800000);if(s.c_r(c"
+")){v=0}if(!s.c_w(c,1,t)){s.c_w(c,1,0)}if(!s.c_r(c)){v=0}return v;");