Expand my Community achievements bar.

SOLVED

getTimeToComplete and getTimeBetweenEvents Plug-ins

Avatar

Level 2

I went through the steps outlined on this page to implement the getTimeToComplete plug-in:

Adobe plug-in: getTimeToComplete

 

1) Added the "Common Analytics Plugins extension" in Launch

 

2) Added an action to my "Initialize Plug-ins" rule with the following configuration:
Extension: Common Analytics Plugins
Action Type: Initialize getTimeToComplete

 

3) Added this code to an existing rule: s.getTimeToComplete("start");

 

4) Added this code to another existing rule: s.eVar1 = s.getTimeToComplete("stop");

 

I get this error:

Uncaught (in promise) TypeError: t.getTimeToComplete is not a function

 

I tried using getTimeBetweenEvents instead but I get this error:

Uncaught (in promise) ReferenceError: getTimeBetweenEvents is not defined

 

Any ideas on what's going on? Anyone used these successfully?

 

Ali

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

2) Which event does your "Initialize Plug-ins" rule trigger on? I use "Library Loaded".

3) and 4) Did you include s.getTimeToComplete("start"); and s.eVar1 = s.getTimeToComplete("stop"); in the custom code of an Adobe Analytics "Set Variables" action? They won't work in a Core custom code action.

View solution in original post

11 Replies

Avatar

Correct answer by
Community Advisor

2) Which event does your "Initialize Plug-ins" rule trigger on? I use "Library Loaded".

3) and 4) Did you include s.getTimeToComplete("start"); and s.eVar1 = s.getTimeToComplete("stop"); in the custom code of an Adobe Analytics "Set Variables" action? They won't work in a Core custom code action.

Avatar

Level 2

I accidently marked this as correct.

Yes, I used "Library Loaded" and my start/stop is in a "Set Variables" action.

Avatar

Level 2

I tried setting up a rule to load on "Core - Library Loaded (Page Top)"

Here's the code:

s.getTimeToComplete("start");
var Time = s.getTimeToComplete("stop");

_satellite.logger.info('Time:' + Time)

 

Here's the error in Sources

 

image.png

Avatar

Community Advisor
The code might not work with the "Library Loaded" event, because the plugin might not have completed loading yet. If you use a "DOM Ready" or "Window Loaded" event, does it work?

Avatar

Level 2
I tried both of those and it still doesn't work. I don't understand why it shows "t.getTimeToComplete" in the error instead of "s.getTimeToComplete"?

Avatar

Community Advisor
Are you able to share the website with this Launch property? Or if your library hasn't been published yet, can you share the development environment URL that has your library?

Avatar

Community Advisor

Ok, I think I've found it. The "s" object has been overridden by another script from trkn.us. This trkn.us script is being loaded from utag.js, i.e. from Tealium. So because the "s" object is being overridden, the Adobe Analytics tracking is basically broken.

The solution is: remove whatever is calling that trkn.us script from Tealium, or change it such that it doesn't override the "s" object at the global window level.

How I found it:

  1. Opened your k12.com homepage.
  2. Opened the browser's console.
  3. Ran this in the console: window.s

Expected result: A JavaScript object that is the Adobe Analytics tracker.

Actual result: A <script> that calls that trkn.us script.

Avatar

Level 10
Do any of the answers below answer your initial question? If so, can you select one of them as the correct answer? If none of the answers already provided answer your question, can you provide additional information to better help the community solve your question?

Avatar

Level 2

Hi, I am having issue with the same plugin, I want to expire it for 30 days , even though I gave expiration it's still getting cleared after session , do we have any work around here 

 

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