PageSourceSearch

https://cdn.iol.pt/js/utils/Modules/IOLAnalytics/dist/iol.analytics.js?v202607301204

js iol.pt collected 2026-09-24 08:27:05 UTC 25,371 bytes, 1,075 lines download raw bytes

1'use strict';
2
3
4
5/**
6
7 *
8
9 */
10
11var IOLStringUtilsModule = /** @class */ (function () {
12
13    function IOLStringUtilsModule() {
14
15    }
16
17    /**
18
19     *
20
21     * @param txt
22
23     * @param separator
24
25     */
26
27    IOLStringUtilsModule.normalizeString = function (txt, separator) {
28
29        if (separator === void 0) { separator = "-"; }
30
31        if (!txt)
32
33            return "";
34
35        return txt
36
37            .toLowerCase()
38
39            .normalize("NFD")
40
41            .replace(/[\u0300-\u036f]/g, "")
42
43            .replace(/[^\w\s]|_/g, "")
44
45            .replace(/\s/g, separator);
46
47    };
48
49    /**
50
51     *
52
53     * @param text
54
55     */
56
57    IOLStringUtilsModule.stripHTMLFromString = function (text) {
58
59        var e = document.createElement("div");
60
61        e.innerHTML = text;
62
63        return e.childNodes.length === 0 ? "" : e.childNodes[0].nodeValue;
64
65    };
66
67    /**
68
69     *
70
71     * @param text
72
73     * @param length
74
75     */
76
77    IOLStringUtilsModule.simplifyAndCutEncodedString = function (text, length) {
78
79        var strNormalize = text;
80
81        if (decodeURIComponent(text) !== text)
82
83            strNormalize = decodeURIComponent(text);
84
85        //remove " and &
86
87        var parser = new DOMParser();
88
89        var dom = parser.parseFromString("<!doctype html><body>" + strNormalize, "text/html");
90
91        strNormalize = dom.body.textContent;
92
93        strNormalize = strNormalize
94
95            .trim()
96
97            .normalize("NFD")
98
99            .replace(/[\u0300-\u036f]/g, "")
100
101            .replace(/['"]+/g, "")
102
103            .replace(/[^\w\s]|_/g, "");
104
105        strNormalize = encodeURIComponent(strNormalize);
106
107        if (strNormalize.length > length) {
108
109            strNormalize = strNormalize.substring(0, length);
110
111            while (!IOLStringUtilsModule.isAValidadEncodedText(strNormalize)) {
112
113                strNormalize = strNormalize.substring(0, strNormalize.lastIndexOf("%"));
114
115            }
116
117        }
118
119        return decodeURIComponent(strNormalize);
120
121    };
122
123    /**
124
125     *
126
127     * @param text
128
129     */
130
131    IOLStringUtilsModule.isAValidadEncodedText = function (text) {
132
133        try {
134
135            decodeURIComponent(text);
136
137            return true;
138
139        }
140
141        catch (err) {
142
143            return false;
144
145        }
146
147    };
148
149    /**
150
151     * http://stg.tvi24.iol.pt/opiniao/miguel-sousa-tavares/s.... to tvi24.iol.pt
152
153     * @param referrer
154
155     */
156
157    IOLStringUtilsModule.getDomainFromURL = function (referrer) {
158
159        referrer = referrer.replace("https://", "");
160
161        referrer = referrer.replace("http://", "");
162
163        referrer = referrer.substring(0, referrer.indexOf("/"));
164
165        referrer = referrer.replace("stg.", "");
166
167        referrer = referrer.replace("dev.", "");
168
169        referrer = referrer.replace("dev", "");
170
171        referrer = referrer.replace("www.", "");
172
173        return referrer;
174
175    };
176
177    return IOLStringUtilsModule;
178
179}());
180
181
182
183/**
184
185 *
186
187 */
188
189var IOLCookiesUtilsModule = /** @class */ (function () {
190
191    function IOLCookiesUtilsModule() {
192
193    }
194
195    IOLCookiesUtilsModule.getCookie = function (name) {
196
197        var nameLenPlus = name.length + 1;
198
199        return (document.cookie
200
201            .split(";")
202
203            .map(function (c) { return c.trim(); })
204
205            .filter(function (cookie) {
206
207            return cookie.substring(0, nameLenPlus) === name + "=";
208
209        })
210
211            .map(function (cookie) {
212
213            return decodeURIComponent(cookie.substring(nameLenPlus));
214
215        })[0] || null);
216
217    };
218
219    IOLCookiesUtilsModule.createCookie = function (name, value, expires, path, domain) {
220
221        document.cookie = name + "=" + value + ";expires=" + expires.toUTCString() + ";path=" + path + ";domain=" + domain;
222
223    };
224
225    IOLCookiesUtilsModule.removeCookie = function (name, path, domain) {
226
227        var date = new Date();
228
229        date.setTime(date.getTime() + -1 * 24 * 60 * 60 * 1000);
230
231        document.cookie = name + "=\"\";expires=" + date.toUTCString() + ";path=" + path + ";domain=" + domain;
232
233    };
234
235    return IOLCookiesUtilsModule;
236
237}());
238
239
240
241/*! *****************************************************************************
242
243Copyright (c) Microsoft Corporation. All rights reserved.
244
245Licensed under the Apache License, Version 2.0 (the "License"); you may not use
246
247this file except in compliance with the License. You may obtain a copy of the
248
249License at http://www.apache.org/licenses/LICENSE-2.0
250
251
252
253THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
254
255KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
256
257WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
258
259MERCHANTABLITY OR NON-INFRINGEMENT.
260
261
262
263See the Apache Version 2.0 License for specific language governing permissions
264
265and limitations under the License.
266
267***************************************************************************** */
268
269
270
271var __assign = function() {
272
273    __assign = Object.assign || function __assign(t) {
274
275        for (var s, i = 1, n = arguments.length; i < n; i++) {
276
277            s = arguments[i];
278
279            for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
280
281        }
282
283        return t;
284
285    };
286
287    return __assign.apply(this, arguments);
288
289};
290
291
292
293/**
294
295 * Represents a data layer dimension
296
297 */
298
299var IOLDataLayerItem = /** @class */ (function () {
300
301    function IOLDataLayerItem(itemDimensionName, itemType, itemDefaultValue, itemValue) {
302
303        this.itemDimensionName = itemDimensionName;
304
305        this.itemType = itemType;
306
307        this.itemDefaultValue = itemDefaultValue;
308
309        this.itemValue = itemValue;
310
311    }
312
313    /**
314
315     * Return the value of the dimension
316
317     */
318
319    IOLDataLayerItem.prototype.getValue = function () {
320
321        return this.itemValue ? this.itemValue : this.itemDefaultValue;
322
323    };
324
325    return IOLDataLayerItem;
326
327}());
328
329/**
330
331 * Represent the type of event for the dimension
332
333 */
334
335var IOLDataLayerType;
336
337(function (IOLDataLayerType) {
338
339    IOLDataLayerType[IOLDataLayerType["PAGEVIEW"] = 0] = "PAGEVIEW";
340
341    IOLDataLayerType[IOLDataLayerType["EVENT"] = 1] = "EVENT";
342
343    IOLDataLayerType[IOLDataLayerType["BOTH"] = 2] = "BOTH";
344
345})(IOLDataLayerType || (IOLDataLayerType = {}));
346
347
348
349/**
350
351 * Represent the data layer sent to the Tag Manager
352
353 */
354
355var IOLDataLayerObject = /** @class */ (function () {
356
357    function IOLDataLayerObject(pageTitle, contentType, contentTitle, contentId, contentEpisodeId, contentProgramName, contentAuthor, contentKeywords, contentVideoPlay, contentVideoType, contentLiveType, version, platform, adunit, internalOrigin, section, data, afiliado, duration) {
358
359        this.MAX_LENG = 150;
360
361        this.dimensionsValues = [];
362
363        // Saber qual o formato do conteúdo, se são galerias, videos, páginas de secção, página conteúdo, (Para saber as Galerias dentro dos artigos, o Tipo conteúdo é Galeria e depois na origem interna temos a info de que é artigo)
364
365        this.dimensionsValues.push(new IOLDataLayerItem("Tipo_Conteudo", IOLDataLayerType.BOTH, "", contentType.charAt(0).toUpperCase() + contentType.slice(1)));
366
367        this.pageTitle = IOLStringUtilsModule.simplifyAndCutEncodedString(pageTitle, this.MAX_LENG);
368
369        //Titulo da Página
370
371        this.dimensionsValues.push(new IOLDataLayerItem("virtualPageTitle", IOLDataLayerType.BOTH, "", this.pageTitle));
372
373        //Titulo do video ou da galeria ou artigo
374
375        this.dimensionsValues.push(new IOLDataLayerItem("Titulo", IOLDataLayerType.BOTH, "", IOLStringUtilsModule.simplifyAndCutEncodedString(contentTitle, this.MAX_LENG)));
376
377        //Id do conteúdo, no tagmanager chama-se multimedia id
378
379        this.dimensionsValues.push(new IOLDataLayerItem("Multimedia_Id", IOLDataLayerType.BOTH, "Sem ID", contentId));
380
381        //Id do episódio
382
383        this.dimensionsValues.push(new IOLDataLayerItem("Episodio_Id", IOLDataLayerType.EVENT, "Sem Episodio", contentEpisodeId));
384
385        //Nome do programa, tanto para videos como para páginas
386
387        this.dimensionsValues.push(new IOLDataLayerItem("Programa_Nome", IOLDataLayerType.BOTH, "Sem Programa", IOLStringUtilsModule.simplifyAndCutEncodedString(contentProgramName, this.MAX_LENG)));
388
389        //Autor do artigo
390
391        this.dimensionsValues.push(new IOLDataLayerItem("Autor", IOLDataLayerType.PAGEVIEW, "Sem Autor", IOLStringUtilsModule.simplifyAndCutEncodedString(contentAuthor, this.MAX_LENG)));
392
393        //Tópicos dos artigos
394
395        this.dimensionsValues.push(new IOLDataLayerItem("Tags", IOLDataLayerType.PAGEVIEW, "Sem Tags", IOLStringUtilsModule.simplifyAndCutEncodedString(contentKeywords, this.MAX_LENG)));
396
397        //Saber qual a versão do player que utilizamos
398
399        this.dimensionsValues.push(new IOLDataLayerItem("versao player", IOLDataLayerType.EVENT, "", version));
400
401        //Se o play programa foi gerado em simultaneo que o Video Play
402
403        this.dimensionsValues.push(new IOLDataLayerItem("Videoplay_Simultaneo", IOLDataLayerType.EVENT, "", contentVideoPlay));
404
405        //Tipo do video, se é integra, cliq, live ou macro
406
407        this.dimensionsValues.push(new IOLDataLayerItem("Tipo", IOLDataLayerType.EVENT, "", contentVideoType));
408
409        //Se o program está a ser trasmitido em direto, online ou vod
410
411        this.dimensionsValues.push(new IOLDataLayerItem("Live", IOLDataLayerType.EVENT, "", contentLiveType));
412
413        //A plataforma pelo qual o conteúdo está a ser visto, IA, AMP, WEB e APP
414
415        this.dimensionsValues.push(new IOLDataLayerItem("Plataforma", IOLDataLayerType.BOTH, "", platform.toUpperCase()));
416
417        //Nome da adunit do dfp
418
419        this.dimensionsValues.push(new IOLDataLayerItem("AdUnit", IOLDataLayerType.BOTH, "", adunit ? adunit.toLowerCase() : ""));
420
421        //Nome do local onde o utilizador clicou já no site para ir ter ao conteúdo
422
423        this.dimensionsValues.push(new IOLDataLayerItem("origem_interna", IOLDataLayerType.PAGEVIEW, "Externo||Nao Definido||Nao Definido||Nao Definido", internalOrigin));
424
425        //Nome da secção
426
427        this.dimensionsValues.push(new IOLDataLayerItem("Seccao", IOLDataLayerType.PAGEVIEW, section));
428
429        //Data
430
431        this.dimensionsValues.push(new IOLDataLayerItem("Data", IOLDataLayerType.PAGEVIEW, data));
432
433        if(afiliado && afiliado !== "") {
434            this.dimensionsValues.push(new IOLDataLayerItem("afiliado", IOLDataLayerType.PAGEVIEW, afiliado));
435        }
436
437        if(duration && duration !== "") {
438            this.dimensionsValues.push(new IOLDataLayerItem("Duracao", IOLDataLayerType.EVENT, duration));
439        }
440
441    }
442
443    /**
444
445     * Convert to a JSON object depending on the event type
446
447     * @param {IOLDataLayerType} dataLayerType
448
449     */
450
451    IOLDataLayerObject.prototype.toObject = function (dataLayerType) {
452
453        var obj = {};
454
455        var values = this.dimensionsValues.filter(function (value, index) {
456
457            return value.itemType === dataLayerType ||
458
459                value.itemType === IOLDataLayerType.BOTH;
460
461        });
462
463        values.forEach(function (element) {
464
465            obj[element.itemDimensionName] = element.getValue();
466
467        });
468
469        return obj;
470
471    };
472
473    /**
474
475     * Create the JSON Object for a Virtual Page View
476
477     * @param {string} pageUrl
478
479     * @param {string} pageTitle
480
481     * @param {object} extraValuesObject
482
483     */
484
485    IOLDataLayerObject.prototype.toUpdateVirtualPageViewObj = function (pageUrl, extraValuesObject) {
486
487        var initObjc = {
488
489            virtualPageURL: pageUrl,
490
491            event: "VirtualPageview"
492
493        };
494
495        if (extraValuesObject)
496
497            initObjc = __assign(__assign({}, initObjc), extraValuesObject);
498
499        return __assign(__assign({}, initObjc), this.toObject(IOLDataLayerType.PAGEVIEW));
500
501    };
502
503    /**
504
505     * Create the JSON Object for an Event
506
507     * @param {string} eventCategory
508
509     * @param {string} eventLabel
510
511     * @param {string} eventAction
512
513     * @param {string} eventType
514
515     * @param {object} extraValuesObject
516
517     */
518
519    IOLDataLayerObject.prototype.toEventObject = function (eventCategory, eventLabel, eventAction, eventType, extraValuesObject) {
520
521        var initObjc = {
522
523            eventCategory: eventCategory,
524
525            eventLabel: eventLabel,
526
527            eventAction: eventAction,
528
529            event: eventType
530
531        };
532
533        if (extraValuesObject)
534
535            initObjc = __assign(__assign({}, initObjc), extraValuesObject);
536
537        return __assign(__assign({}, initObjc), this.toObject(IOLDataLayerType.EVENT));
538
539    };
540
541    return IOLDataLayerObject;
542
543}());
544
545
546
547/**
548
549 * Analyics Module
550
551 */
552
553var IOLAnalytics = /** @class */ (function () {
554
555    /**
556
557     * Loads the IOLAnalytics Module, which includes:
558
559     *  1. Reading the cookies for the internal origin
560
561     *  2. Reading the content metadata
562
563     *  3. Creating the data layer
564
565     *  4. Loading the GTM
566
567     */
568
569    function IOLAnalytics() {
570
571        this.MAX_LENG = 150;
572
573        this.COOKIE_NAME = "analytics_origin";
574
575        this.INTERNAL_URLS = {
576
577            "iol.pt": "IOL",
578
579            "tvi.iol.pt": "TVI",
580
581            "tvi24.iol.pt": "TVI24",
582
583            "tviplayer.iol.pt": "TVIPLAYER",
584
585            "maisfutebol.iol.pt": "MAISFUTEBOL",
586
587            "selfie.iol.pt": "SELFIE",
588
589            "autoportal.iol.pt": "AUTOPORTAL",
590
591            "lux.iol.pt": "LUX"
592
593        };
594
595        this.readCookies();
596
597        this.readMetadata();
598
599        this.createDataLayer();
600
601        this.loadGTM();
602
603    }
604
605    /**
606
607     * Checks the cookies for internal origin
608
609     */
610
611    IOLAnalytics.prototype.readCookies = function () {
612
613        this.cookie_origin = IOLCookiesUtilsModule.getCookie(this.COOKIE_NAME);
614
615        IOLCookiesUtilsModule.removeCookie(this.COOKIE_NAME, "/", "iol.pt");
616
617    };
618
619    /**
620
621     * Gets the content information from the metatags
622
623     */
624
625    IOLAnalytics.prototype.readMetadata = function () {
626
627        this.iol_ctags = document
628
629            .querySelector("meta[property='iol:ctags']")
630
631            .getAttribute("content");
632
633        this.iol_tags = document
634
635            .querySelector("meta[property='iol:tags']")
636
637            .getAttribute("content");
638
639        this.iol_author = document
640
641            .querySelector("meta[property='iol:author']")
642
643            .getAttribute("content");
644
645        this.iol_content_type = document
646
647            .querySelector("meta[property='iol:content_type']")
648
649            .getAttribute("content");
650
651        this.iol_section = document
652
653            .querySelector("meta[property='iol:section']")
654
655            .getAttribute("content");
656
657        this.iol_platform = document
658
659            .querySelector("meta[property='iol:platform']")
660
661            .getAttribute("content");
662
663        this.iol_adunit = document
664
665            .querySelector("meta[property='iol:adunit']")
666
667            .getAttribute("content");
668
669        this.iol_programme_name = document
670
671            .querySelector("meta[property='iol:programme_name']")
672
673            .getAttribute("content");
674
675        this.iol_episode = document
676
677            .querySelector("meta[property='iol:episode']")
678
679            .getAttribute("content");
680
681        this.iol_content = document
682
683            .querySelector("meta[property='iol:content']")
684
685            .getAttribute("content");
686
687        this.iol_content_title = document
688
689            .querySelector("meta[property='iol:content_title']")
690
691            .getAttribute("content");
692
693        this.iol_gtm = document
694
695            .querySelector("meta[property='iol:gtm']")
696
697            .getAttribute("content");
698
699        this.iol_project = document
700
701            .querySelector("meta[property='iol:project']")
702
703            .getAttribute("content");
704
705        this.iol_data = document.querySelector("meta[property='iol:data']") ? 
706                        document.querySelector("meta[property='iol:data']").getAttribute("content") : "";
707
708        this.iol_afiliado = document.querySelector("meta[property='iol:afiliado']") ? 
709                        document.querySelector("meta[property='iol:afiliado']").getAttribute("content") : "";
710        
711
712        //definir os dados a enviar para o dário e guardar na meta
713
714        if (this.cookie_origin)
715
716            this.iol_page_origin = this.cookie_origin;
717
718        else {
719
720            this.iol_page_origin = this.getReferrer() + "||Nao Definido||Nao Definido||Nao Definido";
721
722        }
723
724    };
725
726    /**
727
728     * Gets the URL referal
729
730     */
731
732    IOLAnalytics.prototype.getReferrer = function () {
733
734        var referrer = this.INTERNAL_URLS[IOLStringUtilsModule.getDomainFromURL(document.referrer)];
735
736        return referrer ? referrer : "Externo";
737
738    };
739
740    /**
741
742     * Creates the default Data Layer
743
744     */
745
746    IOLAnalytics.prototype.createDataLayer = function () {
747
748        this.dataLayerObj = new IOLDataLayerObject(this.iol_content_title, this.iol_content_type, this.iol_content_title, this.iol_content, this.iol_episode, this.iol_programme_name, this.iol_author, this.iol_tags, "", "", "", "", this.iol_platform, this.iol_adunit, this.iol_page_origin, this.iol_section, this.iol_data, this.iol_afiliado);
749
750        window.dataLayer = [
751
752            this.dataLayerObj.toObject(IOLDataLayerType.PAGEVIEW)
753
754        ];
755
756    };
757
758    /**
759
760     * Loads Google Tag Manager
761
762     */
763
764    IOLAnalytics.prototype.loadGTM = function () {
765
766        (function (w, d, s, l, i) {
767
768            w[l] = w[l] || [];
769
770            w[l].push({ "gtm.start": new Date().getTime(), event: "gtm.js" });
771
772            var f = d.getElementsByTagName(s)[0], j = d.createElement(s), dl = l != "dataLayer" ? "&l=" + l : "";
773
774            j["async"] = true;
775
776            j["src"] = "https://www.googletagmanager.com/gtm.js?id=" + i + dl;
777
778            f.parentNode.insertBefore(j, f);
779
780        })(window, document, "script", "dataLayer", this.iol_gtm);
781
782    };
783
784    /**
785
786     * Listen to click on anchor elements that aren't already measeured
787
788     * @param {boolean} onload
789
790     */
791
792    IOLAnalytics.prototype.clickListener = function (onload) {
793
794        if (onload) {
795
796            var _this = this;
797
798            document.addEventListener("DOMContentLoaded", function () {
799
800                _this.loadClickListener();
801
802            });
803
804        }
805
806        else {
807
808            this.loadClickListener();
809
810        }
811
812    };
813
814    /**
815
816     * Listen to click on anchor elements that aren't already measured
817
818     */
819
820    IOLAnalytics.prototype.loadClickListener = function () {
821
822        var _this = this;
823
824        var elementsToMeasure = document.querySelectorAll("a:not(.not-measure):not(.already-measured)");
825
826        elementsToMeasure.forEach(function (element) {
827
828            element.classList.add("already-measured");
829
830            element.addEventListener("click", function () {
831
832                var identity = this.getAttribute("data-iol-identity");
833
834                if (!identity) {
835
836                    var parent = this.parentNode.parentNode;
837
838                    identity = parent.getAttribute("data-iol-identity");
839
840                    while (parent.classList.length === 0 && !identity) {
841
842                        parent = parent.parentNode;
843
844                        identity = parent.getAttribute("data-iol-identity");
845
846                    }
847
848                }
849
850                var origin = _this.iol_project.toUpperCase() + "||" + (_this.iol_section ? _this.iol_section.toLowerCase() : "Não Definido") + "||" + (_this.iol_content_type
851
852                    ? _this.iol_content_type.toLowerCase()
853
854                    : "Não Definido") + "||" + identity.toLowerCase();
855
856                var expirationDate = new Date();
857
858                expirationDate.setTime(expirationDate.getTime() + 60 * 1000);
859
860                IOLCookiesUtilsModule.createCookie(_this.COOKIE_NAME, origin, expirationDate, "/", "iol.pt");
861
862            });
863
864        });
865
866    };
867
868    /**
869
870     * Sets the internal origin
871
872     * @param {string} identity
873
874     * @param {boolean} isRedirect
875
876     */
877
878    IOLAnalytics.prototype.setInternalOrigin = function (identity, isRedirect) {
879
880        var origin = this.defineInternalOrigin(identity, isRedirect);
881
882        if (!isRedirect) {
883
884            if (typeof window.dataLayer !== "undefined" && origin) {
885
886                window.dataLayer.push({ origem_interna: origin });
887
888            }
889
890        }
891
892    };
893
894    /**
895
896     * Defines the internal origin, in case of a redirect also creates the cookie
897
898     * @param {string} identity
899
900     * @param {boolean} isRedirect
901
902     */
903
904    IOLAnalytics.prototype.defineInternalOrigin = function (identity, isRedirect) {
905
906        var origin = this.iol_project.toUpperCase() + "||" + this.iol_section.toLowerCase() + "||" + this.iol_content_type.toLowerCase() + "||" + identity.toLowerCase();
907
908        if (isRedirect) {
909
910            var expirationDate = new Date();
911
912            expirationDate.setTime(expirationDate.getTime() + 60 * 1000);
913
914            IOLCookiesUtilsModule.createCookie(this.COOKIE_NAME, origin, expirationDate, "/", "iol.pt");
915
916            return "";
917
918        }
919
920        return origin;
921
922    };
923
924    /**
925
926     * Sends a VirtualPageView
927
928     */
929
930    IOLAnalytics.prototype.updateVirtualPageView = function (pageUrl, dataLayerObj, extraValuesObject) {
931
932        if (dataLayerObj === void 0) { dataLayerObj = undefined; }
933
934        if (extraValuesObject === void 0) { extraValuesObject = undefined; }
935
936        if (dataLayerObj) {
937
938            var obj = dataLayerObj.toUpdateVirtualPageViewObj(pageUrl, extraValuesObject);
939
940            window.dataLayer.push(obj);
941
942        }
943
944    };
945
946    /**
947
948     * Sends a event to Tag Manager
949
950     * @param {string} category
951
952     * @param {string} label
953
954     * @param {string} action
955
956     * @param {string} eventType
957
958     * @param {IOLDataLayerObject} dataLayerObj
959
960     * @param {object} extraValuesObject
961
962     */
963
964    IOLAnalytics.prototype.sendEvent = function (category, label, action, eventType, dataLayerObj, extraValuesObject) {
965
966        if (extraValuesObject === void 0) { extraValuesObject = undefined; }
967
968        if (dataLayerObj) {
969
970            var obj = dataLayerObj.toEventObject(category, label, action, eventType, extraValuesObject);
971
972            window.dataLayer.push(obj);
973
974        }
975
976        else {
977
978            //clean up datalayer Dário
979
980            if (extraValuesObject) {
981
982                window.dataLayer.push(extraValuesObject);
983
984            }
985
986        }
987
988    };
989
990    /**
991
992     * * Create a {IOLDataLayerObject} simplyfied
993
994     * @param {string}  contentType
995
996     * @param {string}  contentTitle
997
998     * @param {string}  contentId
999
1000     * @param {string}  platform
1001
1002     * @param {string}  adunit
1003
1004     * @param {string}  internalOrigin
1005
1006     * @param {boolean} isRedirect
1007
1008     */
1009
1010    IOLAnalytics.prototype.createSimpleDataLayerObject = function (contentType, contentTitle, contentId, platform, adunit, internalOrigin, isRedirect) {
1011
1012        return new IOLDataLayerObject(this.dataLayerObj.pageTitle, contentType, contentTitle, contentId, "", "", "", "", "", "", "", "", platform, adunit, this.defineInternalOrigin(internalOrigin, isRedirect), "", "", "", "");
1013
1014    };
1015
1016    IOLAnalytics.prototype.createSimpleDataLayerObjectWithTitle = function (pageTitle, contentType, contentTitle, contentId, platform, adunit, internalOrigin, isRedirect) {
1017
1018        return new IOLDataLayerObject(pageTitle, contentType, contentTitle, contentId, "", "", "", "", "", "", "", "", platform, adunit, this.defineInternalOrigin(internalOrigin, isRedirect), "", "", "", "");
1019
1020    };
1021
1022    /**
1023
1024     * Create a {IOLDataLayerObject}
1025
1026     * @param {string} contentType
1027
1028     * @param {string} contentTitle
1029
1030     * @param {string} contentId
1031
1032     * @param {string} contentEpisodeId
1033
1034     * @param {string} contentProgramName
1035
1036     * @param {string} contentAuthor
1037
1038     * @param {string} contentKeywords
1039
1040     * @param {string} contentVideoPlay
1041
1042     * @param {string} contentVideoType
1043
1044     * @param {string} contentLiveType
1045
1046     * @param {string} version
1047
1048     * @param {string} platform
1049
1050     * @param {string} adunit
1051
1052     * @param {string} internalOrigin
1053
1054     * @param {boolean} isRedirect
1055
1056     */
1057
1058    IOLAnalytics.prototype.createDataLayerObject = function (contentType, contentTitle, contentId, contentEpisodeId, contentProgramName, contentAuthor, contentKeywords, contentVideoPlay, contentVideoType, contentLiveType, version, platform, adunit, internalOrigin, isRedirect) {
1059
1060        return new IOLDataLayerObject(this.dataLayerObj.pageTitle, contentType, contentTitle, contentId, contentEpisodeId, contentProgramName, contentAuthor, contentKeywords, contentVideoPlay, contentVideoType, contentLiveType, version, platform, adunit, this.defineInternalOrigin(internalOrigin, isRedirect), "", "", "", "");
1061
1062    };
1063
1064    IOLAnalytics.prototype.createDataLayerObjectWithDuration = function (contentType, contentTitle, contentId, contentEpisodeId, contentProgramName, contentAuthor, contentKeywords, contentVideoPlay, contentVideoType, contentLiveType, version, platform, adunit, internalOrigin, isRedirect, duration) {
1065
1066        return new IOLDataLayerObject(this.dataLayerObj.pageTitle, contentType, contentTitle, contentId, contentEpisodeId, contentProgramName, contentAuthor, contentKeywords, contentVideoPlay, contentVideoType, contentLiveType, version, platform, adunit, this.defineInternalOrigin(internalOrigin, isRedirect), "", "", "", duration);
1067
1068    };
1069
1070    return IOLAnalytics;
1071
1072}());
1073
1074
1075

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.