Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

getTimeToComplete and getTimeBetweenEvents Plug-ins

AliMaleki
Level 2
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
yuhuisg
Correct answer by
Community Advisor
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

10 Replies
yuhuisg
Correct answer by
Community Advisor
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

AliMaleki
Level 2
Level 2

I accidently marked this as correct.

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

AliMaleki
Level 2
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

yuhuisg
Community Advisor
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?
AliMaleki
Level 2
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"?
yuhuisg
Community Advisor
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?
yuhuisg
Community Advisor
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.

jantzen_belliston-Adobe
Community Manager
Community Manager
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?