(analyticsTrigger, a4a, qqid)
| 638 | * @return {!JsonObject} |
| 639 | */ |
| 640 | export function getCsiAmpAnalyticsVariables(analyticsTrigger, a4a, qqid) { |
| 641 | const {win} = a4a; |
| 642 | const ampdoc = a4a.getAmpDoc(); |
| 643 | const navStart = getNavigationTiming(win, 'navigationStart'); |
| 644 | const vars = /** @type {!JsonObject} */ ({ |
| 645 | 'correlator': getCorrelator(win, ampdoc), |
| 646 | 'slotId': a4a.element.getAttribute('data-amp-slot-index'), |
| 647 | 'viewerLastVisibleTime': ampdoc.getLastVisibleTime() - navStart, |
| 648 | }); |
| 649 | if (qqid) { |
| 650 | vars['qqid'] = qqid; |
| 651 | } |
| 652 | if (analyticsTrigger == 'ad-render-start') { |
| 653 | vars['scheduleTime'] = a4a.element.layoutScheduleTime - navStart; |
| 654 | } |
| 655 | return vars; |
| 656 | } |
| 657 | |
| 658 | /** |
| 659 | * Extracts configuration used to build amp-analytics element for active view |
no test coverage detected