Install the plug-in manually implementing the Web SDK
This plug-in is not yet supported for use within a manual implementation of the Web SDK.
Install the plug-in using the Adobe Analytics extension
Adobe offers an extension that allows you to use most commonly-used plug-ins with Adobe Analytics.
-
Log in to Adobe Experience Platform Data Collection using your AdobeID credentials.
-
Click the desired tag property.
-
Go to the Extensions tab, then click on the Catalog button
-
Install and publish the Common Analytics Plugins extension
-
If you haven’t already, create a rule labeled “Initialize Plug-ins” with the following configuration:
- Condition: None
- Event: Core – Library Loaded (Page Top)
-
Add an action to the above rule with the following configuration:
- Extension: Common Analytics Plugins
- Action Type: Initialize getTimeSinceLastVisit
-
Save and publish the changes to the rule.
Install the plug-in using custom code editor
If you do not want to use the Common Analytics Plugins plug-in extension, you can use the custom code editor.
- Log in to Adobe Experience Platform Data Collection using your AdobeID credentials.
- Click on the desired property.
- Go to the Extensions tab, then click the Configure button under the Adobe Analytics extension.
- Expand the Configure tracking using custom code accordion, which reveals the Open Editor button.
- Open the custom code editor and paste the plug-in code provided below into the edit window.
- Save and publish the changes to the Analytics extension.
Install the plug-in using AppMeasurement
Copy and paste the following code anywhere in the AppMeasurement file after the Analytics tracking object is instantiated (using s_gi). Preserving comments and version numbers of the code in your implementation helps Adobe with troubleshooting any potential issues.
Use the plug-in
The getTimeSinceLastVisit function does not use any arguments. It returns the amount of time elapsed since the visitor last came to the site, bucketed in the following format:
- Time between 30 minutes and an hour since the last visit is set to the nearest half-minute benchmark. For example,
"30.5 minutes","53 minutes" - Time between an hour and a day is rounded to the nearest quarter-hour benchmark. For example,
"2.25 hours","7.5 hours" - Time greater than a day is rounded to the nearest day benchmark. For example,
"1 day","3 days","9 days","372 days" - If a visitor has not visited before or the time elapsed is greater than two years, the value is set to
"New Visitor".
This plug-in creates a first-party cookie called "s_tslv" set to a Unix timestamp of the current time. The cookie expires after two years of inactivity.
Examples
Version History
2.0 (March 19, 2021)
- Added version number as context data.
1.0 (April 16, 2018)
- Point release (recompiled code and smaller size).
- Code derived from the
getDaysSinceLastVisitplug-in (now deprecated and renamed). - Now uses
formatTimeandinListplug-ins for the return value.
More help on this topic
Was this content helpful?
Announcements
Get hands-on with agentic AI.
Explore how AI agents work together through real examples and hands-on practice. Join your local User Group to design an agent workflow with your peers and leave with a practical framework you can apply to your own work.
Find an eventAdobe CX Analytics Portfolio Roadmap Webinar - Americas & EMEA
Preview the CX Analytics roadmap across CJA, Adobe Analytics, and more. Ask the team.
Adobe CX Analytics Portfolio Roadmap Webinar - Americas & APAC
Preview the CX Analytics roadmap across CJA, Adobe Analytics, and more. Ask the team.