Expand my Community achievements bar.

SOLVED

Create audience to target users who staying on the page longer than a given time period

Avatar

Level 2

Hi Adobe community,

 

I want to check if there is a way to define the Target audience that only target users who stay on the page longer than a time period, e.g. 10 seconds. The reason why is I have setup the experiment for long staying users but the report mixed the loyal users and users bounced.

 

Thanks for your help

Chris

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @ChrisCh4 , You can create a audience using profile script (profile.browserTime) for personalization.

 

https://experienceleague.adobe.com/en/docs/target/using/audiences/visitor-profiles/profile-parameter...

 

View solution in original post

6 Replies

Avatar

Correct answer by
Community Advisor

Hi @ChrisCh4 , You can create a audience using profile script (profile.browserTime) for personalization.

 

https://experienceleague.adobe.com/en/docs/target/using/audiences/visitor-profiles/profile-parameter...

 

Avatar

Level 2

Thanks @pradnya_balvir 
May I check what is the value expected from the `profile.browserTime`?
Is it the number of seconds that we can compare using static value?

Now I am setting a new profile script with the code below
`return user.get('browserTime');`
then to create a new audience profile to compare the targeted value.
Please have a look if I am doing correctly? Thanks

Avatar

Community Advisor

Hi @ChrisCh4 

As per my previous reply

profile.browserTime The visitor’s local browser time. For system time, create a new date object in the profile script

 

source: https://experienceleague.adobe.com/en/docs/target/using/audiences/visitor-profiles/variables-profile... 

Avatar

Level 2

Hi @kandersen thanks for the clarification.
Could you demonstrate the profile script you defined to return the user staying time in buckets? Much appreciated.

Avatar

Community Advisor

It could be something along these lines:

// Check if this is the first time the user visited the page during this session
    if (user.sessionId != user.getLocal('sessionIdTimeTracking')) {
        // New session detected, set the initial visit timestamp
        user.setLocal('sessionIdTimeTracking', user.sessionId);
        user.setLocal('initialVisitTimestamp', new Date().getTime());
    }

    // Calculate time spent in seconds
    var currentTime = new Date().getTime();
    var initialVisitTimestamp = user.getLocal('initialVisitTimestamp') || currentTime;
    var timeSpent = (currentTime - initialVisitTimestamp) / 1000;

    // Define time spent buckets
    var timeSpentBucket = "";
    if (timeSpent < 15) {
        timeSpentBucket = "less than 15 seconds";
    } else if (timeSpent >= 15 && timeSpent < 30) {
        timeSpentBucket = "15 to 29 seconds";
    } else if (timeSpent >= 30 && timeSpent < 60) {
        timeSpentBucket = "30 to 59 seconds";
    } else if (timeSpent >= 60 && timeSpent < 180) {
        timeSpentBucket = "1 to 3 minutes";
    } else if (timeSpent >= 180 && timeSpent < 300) {
        timeSpentBucket = "3 to 5 minutes";
    } else if (timeSpent >= 300 && timeSpent < 600) {
        timeSpentBucket = "5 to 10 minutes";
    } else if (timeSpent >= 600 && timeSpent < 900) {
        timeSpentBucket = "10 to 15 minutes";
    } else if (timeSpent >= 900 && timeSpent < 1200) {
        timeSpentBucket = "15 to 20 minutes";
    } else if (timeSpent >= 1200 && timeSpent < 1800) {
        timeSpentBucket = "20 to 30 minutes";
    } else {
        timeSpentBucket = "more than 30 minutes";
    }

    return timeSpentBucket;

The timeSpentBucket will reset at every new session/visit, so depending on your site it may not be necessary with buckets above 10 min.

Hope this is helpful.

Avatar

Community Advisor

@ChrisCh4 

profile.browserTime specifies only the respective browser time. See this for details: 

https://experienceleague.adobe.com/en/docs/target/using/audiences/visitor-profiles/variables-profile...

 

With this you can e.g. determine if it is morning or rather evening for the user and accordingly display e.g. personalizations.

 

If you want to track time spent on site, you can easily create your own script as a kind of counter. There are several possibilities how to build it - I would recommend grouping values in buckets like:

 

less than 15 seconds
15 to 29 seconds
30 to 59 seconds
1 to 3 minutes
3 to 5 minutes
5 to 10 minutes
10 to 15 minutes
15 to 20 minutes
20 to 30 minutes
more than 30 minutes

 

let me know if you’re not familiar with profile scripts.