PageSourceSearch

https://www.schlagerradio.de/wp-content/themes/ella-radio-theme/assets/js/crossplan.js?ver=1.0.2

js schlagerradio.de collected 2026-10-02 14:31:53 UTC 3,189 bytes, 105 lines download raw bytes

1/**
2 * Crossplan Audio-Tracking Integration
3 * Schlager Radio Theme
4 * 
5 * Hängt DSGVO-konforme Consent-Parameter an Stream-URLs an
6 */
7
8(function() {
9    'use strict';
10
11    var CROSSPLAN_CONFIG = {
12        enabled: true,
13        detectionList: ['stream.schlagerradio.de']
14    };
15
16    /**
17     * Prüft ob eine Stream-URL zum Crossplan-Tracking passt
18     */
19    function matchesCrossplanDetection(streamUrl) {
20        var list = (window._wpCrossplan && window._wpCrossplan.detectionList) 
21            ? window._wpCrossplan.detectionList 
22            : CROSSPLAN_CONFIG.detectionList;
23        
24        for (var i = 0; i < list.length; i++) {
25            if (streamUrl.indexOf(list[i]) > -1) {
26                return true;
27            }
28        }
29        return false;
30    }
31
32    /**
33     * Gibt die Stream-URL mit Crossplan-Tracking-Parametern zurück.
34     * Wenn kein Consent vorliegt, wird die Original-URL zurückgegeben.
35     */
36    function getStreamUrlWithCrossplan(streamUrl) {
37        if (!CROSSPLAN_CONFIG.enabled) return streamUrl;
38        if (!streamUrl) return streamUrl;
39
40        // Bereits verarbeitet?
41        if (streamUrl.indexOf('aw_0_req.userConsentV2') > -1) return streamUrl;
42
43        // URL passt nicht zum Detection-Pattern?
44        if (!matchesCrossplanDetection(streamUrl)) return streamUrl;
45
46        // Kein Consent/Config vorhanden?
47        if (!window.cpd_configdata || !window.cpd_configdata.url) {
48            if (window.etm) window.etm.adblockDetected = Date.now();
49            return streamUrl;
50        }
51
52        // Parameter anhängen via etm helper
53        if (window.etm && typeof window.etm.appendStreamParam === 'function') {
54            var processedUrl = window.etm.appendStreamParam(streamUrl);
55            
56            // URL validieren
57            try {
58                new URL(processedUrl);
59                return processedUrl;
60            } catch (e) {
61                console.warn('[Crossplan] URL validation failed, using original');
62                return streamUrl;
63            }
64        }
65
66        return streamUrl;
67    }
68
69    /**
70     * Dispatcht das Crossplan Play-Event.
71     * MUSS VOR dem Setzen der neuen Stream-URL aufgerufen werden!
72     */
73    function dispatchCrossplanPlayEvent(channelId, channelName) {
74        if (!CROSSPLAN_CONFIG.enabled) return;
75
76        // Channel-Info aktualisieren BEVOR Event getriggert wird
77        if (window._wpCrossplan) {
78            window._wpCrossplan.channelId = channelId || 'schlager-radio';
79            window._wpCrossplan.channelName = channelName || 'Schlager Radio';
80        }
81
82        if (window.etm && typeof window.etm.triggerPlayEvent === 'function') {
83            window.etm.triggerPlayEvent();
84        }
85    }
86
87    /**
88     * Diagnose-Funktion
89     */
90    function runCrossplanAnalysis() {
91        if (window.etm && typeof window.etm.triggerAnalysis === 'function') {
92            window.etm.triggerAnalysis();
93        }
94    }
95
96    // Global verfügbar machen
97    window.crossplan = {
98        getStreamUrl: getStreamUrlWithCrossplan,
99        dispatchPlayEvent: dispatchCrossplanPlayEvent,
100        runAnalysis: runCrossplanAnalysis,
101        config: CROSSPLAN_CONFIG
102    };
103
104
105})();

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.