Expand my Community achievements bar.

Join us for our next community Coffee Break on February 28th! Four of our Analytics Champions will be joining us to discuss Summit tips, best practices, and any of your Analytics questions!
SOLVED

getTimeToComplete by default expiring after session

Avatar

Level 2

Hi Community,

I have implemented the getTimeToComplete plugin in adobe launch following every step in the documentation, I am trying to clear the cookie after custom no of days, but it is always getting cleared after the session , is there any work around to avoid this? below is the sample code I am using  

 

getTimeToComplete("start","test",30)

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

See if this works:

getTimeToComplete("start", "test", 30, "d");

View solution in original post

9 Replies

Avatar

Employee

As below page, please contact your organization’s Account Manager. They can arrange a meeting with a consultant for assistance!
Thanks!

 

- Adobe plug-in: getTimeToComplete
https://experienceleague.adobe.com/docs/analytics/implementation/vars/plugins/gettimetocomplete.html...

Avatar

Community Advisor

First off, you should check what domain your cookies are being set against... have you configured your implementation for first party cookies, or are you still using a third party implementation.

 

However, first party isn't really enough... the landscape of cookies has changed so much. Even first party cookies are subject to deletion after 7 days in Safari due to Apple's ITP policies, and first party cookies that aren't set by the server or aren't set securely are more subject to deletion... then of course there is the settings on your browser, which can be configured to delete cookies when you close your session....

 

We used to use the getNewRepeat plugin to remember both 30 day and 365 day retention... but I now often see "30 day repeat" but "365 day new" which should be impossible... if a user has repeated in 30 days, they also repeated in 365....  so I just no longer trust that data.

 

These are just the new realities of "cookie-apocalypse" unfortunately.

 

 

However, that said, there are still a number of browsers that will take and use the cookies properly.... but when I tested this code: 
getTimeToComplete("start","test",30)
It's setting a cookie expiry for 30 mins (not 30 days like it's supposed to)....

 

And no matter what value I pass, it's always 30 mins.... I think someone actually broke the plugin (it wouldn't be the first time).

 

Short of trying to rewrite the plugin, I'm not sure I can help you. This seems like someone at Adobe should fix their plugin.....

 

OR don't use their plugin, if you are comfortable with JS, you should be able to create easier to read and maintain code that does the same thing... basically they set a cookie called "test" (or whatever you want to call this usage) passing the current datetime stamp as the value and setting an expiry... when the test is stopped, I assume it reads the datetime value and compares it to the current datetime.... 

Avatar

Correct answer by
Community Advisor

See if this works:

getTimeToComplete("start", "test", 30, "d");

Avatar

Community Advisor

Yeah, that works... looks like the documentation is missing information about the tp argument.... That really should be updated.

Avatar

Community Advisor

I've submitted a pull request for my documentation update suggestion: https://github.com/AdobeDocs/analytics.en/pull/247

Avatar

Level 6

I am trying to track time taken when user creates event scopen and then completes the purchase. Even if a user creates a cart today and comes back after 20 days and complete the purchase it should be tracked. At the same time if the cart is left more than 30 days without completing any purchase that should be expired.  is the below code correct?

 

// Start the timer when the visitor starts the checkout
if(s.events.indexOf("scOpen") > -1) getTimeToComplete("start","adobe-timer", 30, "d");
// Sets prop1 to the amount of time it took to complete the purchase process
if(s.events.indexOf("purchase") > -1) s.prop75 = getTimeToComplete("stop","adobe-timer", 30, "d");

Avatar

Community Advisor

That looks correct... but I would recommend testing this...

 

If you can't wait 30 days for a test cycle; in your test environment change it to something like 3 days.

 

Then go in today and trigger your scOpen  (is this the correct event? Don't you have to open the cart before you can proceed to the purchase? Would it make more sense to look at scAdd (Add product to the cart... so every time something is added it should reset the timer)... then you can complete the purchase tomorrow and check what is recorded... then you have tomorrow to try the Start again, and leave it over the weekend, then after 3 days is exceeded, you can complete your purchase.

 

You can also check your cookies and the expiry dates set there (just look for your name "adobe-timer")

 

Obviously, for this test, don't use incognito or it will clear all your cookies when you close the browser

Avatar

Level 6

In my website when a user clicks add to cart for the first time automatically scopen starts with a unique ID and it continues with that user until a purchase is made. Once a cart is opened (created) the first time, we want to know how long that order takes.  

Avatar

Level 2

Thank you , this worked appreciate your help!