- Page names
- Internal search term
- Step in a conversion funnel
- Etc...
Get Previous Value
The Plug-In
The Get Previous Value plug-in requires the following parameters/input:
$tG.getPreviousValue('[variable to capture]','[cookie name]','[cookie expire days]');
- Variable to capture - This is simply the variable you wish to track. For example, if you are looking for the previous page name, you would pass in your page name variable.
- Cookie name - This is the name that will be used to store the variable value passed in in step 1 above. By default, the cookie persists for the duration of the session.
- Cookie expire days - If the cookie should persist for longer than the current session, use this parameter to specify the number of days. This is an optional parameter.
- Retrieves whatever data was last stored in the cookie.
- Updates cookie with new value (passed in via "variable to capture" parameter mentioned above). If no value, an empty string ("") is stored in the cookie.
- Returns the value identified in step 1. (If "" was captured in step 2, "" will be returned here.)
Example
Get previous page name on first page of site visit:
var pageName="page1";
var prevPageName=$tG.getPreviousValue(pageName,'pv_pn');
Result: prevPageName==""
Get previous page name on second page of site visit:
var pageName="page2";
var prevPageName=$tG.getPreviousValue(pageName,'pv_pn');
Result: prevPageName=="page1"
NOTE: The $tG.getPreviousValue() method has dependencies on the following plug-ins:
- Get Cookie - Used to retrieve cookie values.
- Set Cookie - Used to create/update cookies.
No comments:
Post a Comment