PageSourceSearch

https://subiektywnieofinansach.pl/wp-content/plugins/full-picture-…/modules/gtools/fupi-gtg.js?ver=9.4.2

js subiektywnieofinansach.pl collected 2026-10-02 10:03:12 UTC 5,510 bytes, 209 lines download raw bytes

1FP.fns.ga4_set_g_ids = function(nr, type, ID) {
2	
3	let ga_ids = FP.readCookie('fp_ga_ids');
4
5	if ( ga_ids ) {
6		ga_ids = JSON.parse( ga_ids );
7	} else {
8		ga_ids = {};
9	}
10	
11	ga_ids['ga4' + nr + '_' + type] = ID;
12	
13	FP.setCookie( 'fp_ga_ids', JSON.stringify(ga_ids) );
14}
15
16;(function(window){
17
18	function can_enable_ga4() 	{ return FP.isAllowedToLoad( 'ga4', ['stats'], ['id'], 1, true ); }
19	function can_enable_gads() 	{ return FP.isAllowedToLoad( 'gads', ['stats','marketing'], ['id'], false, true ); }
20
21	load_gtag( can_enable_ga4(), can_enable_gads() );
22
23	// Load on event
24	document.addEventListener('fp_load_scripts', () => {
25		load_gtag( can_enable_ga4(), can_enable_gads() );
26	});
27
28	function load_gads(){    
29		
30		fp.loaded.push( 'gads' );
31		if ( fp.main.debug ) console.log('[FP] Google Ads loaded');
32	}
33
34	function load_ga4( nr, enable_gads, enh_conv_active ) {
35
36		var _ga = fp[ 'ga4' + nr ],
37			params = {};
38
39		if ( enable_gads && fp.gads.id == fp.ga41.id && enh_conv_active ) {
40			params.allow_enhanced_conversions = true;
41		}
42
43		// CHANGE COOKIE PREFIX
44		// optional for the tracking ID #1
45		if ( _ga.cookie_prefix && nr == '1' ) params.cookie_prefix = '_fp4' + nr;
46
47		// enable GA's debug mode
48		// @ https://support.google.com/analytics/answer/7201382?hl=en
49		params.debug_mode = !! fpdata.cookies.ga4_debug;
50
51		
52
53		// SEND CLEAN "PAGE TITLE"
54		if ( _ga.clean_page_title && fpdata.page_title && fpdata.page_title.length > 0 ) {
55			params.page_title = fpdata.page_title;
56
57			// "SEO TITLE" CUSTOM DIMENSION
58			if ( _ga.seo_title ) {
59				params.seo_title = document.title;
60			}
61		}
62
63		// "PAGE LANGUAGE" CUSTOM DIMENSION
64		if ( _ga.page_lang ) {
65			params[_ga.page_lang] = document.documentElement.lang || 'undefined';
66		}
67
68		// "PAGE TYPE" CONTENT GROUPING
69		if ( _ga.page_type && fpdata.page_type && fpdata.page_type.length > 1 ) {
70			params[_ga.page_type] = fpdata.page_type;
71		}
72
73		// "PAGE ID" CUSTOM DIMENSION
74		if ( _ga.page_id && fpdata.page_id && fpdata.page_id > 0 ) {
75			params[_ga.page_id] = '' + fpdata.page_id;
76		}
77
78		// "PAGE NUMBER" CUSTOM DIMENSION
79		if ( _ga.page_number && fpdata.page_number > 0 ) {
80			params[_ga.page_number] = '' + fpdata.page_number;
81		}
82
83		// "AUTHOR DISPLAY NAME" CUSTOM DIMENSION
84		if ( _ga.post_author && fpdata.author_name && fpdata.author_name.length > 0 ) {
85			params[_ga.post_author] = fpdata.author_name;
86		}
87
88		// "AUTHOR ID" CUSTOM DIMENSION
89		if ( _ga.author_id && fpdata.author_id > 0 ) {
90			params[_ga.author_id] = '' + fpdata.author_id;
91		}
92
93		// "PUBLISHED DATE" CUSTOM DIMENSION
94		if ( _ga.post_date && fpdata.published && fpdata.published.length > 0 ) {
95			params[_ga.post_date] = fpdata.published;
96		}
97
98		
99
100		// "SEARCH RESULTS" CUSTOM METRIC
101		if ( _ga.search_results_nr && _ga.search_results_nr.length > 0 && fpdata.search_results && fpdata.search_results > 0 ) {
102			params[_ga.search_results_nr] = parseInt(fpdata.search_results);
103		}
104
105		// "USER ROLE" USER PROPERTY
106		if ( _ga.user_role ) {
107			if ( fpdata.user.role && fpdata.user.role.length > 0 ) {
108				params[_ga.user_role] = fpdata.user.role;
109			}
110		}
111
112		// "TAXONOMY TERMS" CUSTOM DIMENSION
113		if ( _ga.tax_terms && fpdata.terms && fpdata.terms.length > 0 ) {
114
115			var term_arr = fpdata.terms.map( function (term_data) {
116				var term = _ga.send_tax_terms_titles ? term_data.name : term_data.slug;
117				term += _ga.add_tax_term_cat ? ' (' + term_data.taxonomy + ')' : '';
118				return term;
119			} );
120
121			params[_ga.tax_terms] = term_arr.join(', ');
122		}
123
124		window.gtag( 'config', _ga.id, params );
125
126		
127
128		fp.loaded.push('ga4' + nr);
129		if ( fp.main.debug ) console.log('[FP] GA4 #' + nr + ' loaded');
130	}
131
132	function load_gtag( enable_ga4, enable_gads ) {
133
134		if ( ! enable_ga4 && ! enable_gads ) return;
135
136		// Fix missing AW-
137		if ( 
138			fp.gads && 
139			fp.gads.id && 
140			! fp.gads.id.includes('AW-') && 
141			! fp.gads.id.includes('GT-') && 
142			! fp.gads.id.includes('G-') 
143		) fp.gads.id = 'AW-' + fp.gads.id;
144
145		if ( 
146			fp.gads && 
147			fp.gads.id2 && 
148			! fp.gads.id2.includes('AW-') && 
149			! fp.gads.id2.includes('GT-') && 
150			! fp.gads.id2.includes('G-')
151		) fp.gads.id2 = 'AW-' + fp.gads.id2;
152
153		let script_id = enable_ga4 ? fp.ga41.id : fp.gads.id;
154
155		if ( ! script_id ) return;
156
157		// ! Datalayer is already created in head-js.php
158
159		if ( ! fp.loading.includes('gtg') && ! fp?.gtag?.custom_gateway ) {
160
161			fp.loading.push('gtg');
162
163			FP.getScript(
164				'https://www.googletagmanager.com/gtag/js?id=' + script_id,
165				() => { enable_tags( enable_ga4, enable_gads ) },
166				{'async' : 'async'}
167			);
168			
169		} else {
170			enable_tags( enable_ga4, enable_gads );
171		};
172	}
173
174	function enable_tags( enable_ga4, enable_gads ) {
175
176		if ( ! fp.loaded.includes('gtg') ) {
177			window.gtag('js', new Date());
178			fp.loaded.push('gtg');
179		}
180
181		let can_load_ga42 = false,
182			enh_conv_active = false;
183
184		
185
186		if ( enable_ga4 ) {
187			load_ga4(1, enable_gads, enh_conv_active );
188			
189		}
190
191		if ( enable_gads ) {
192
193			if ( ! ( fp.loaded.includes('ga41') && fp.ga41.id == fp.gads.id ) ) {
194				if ( enh_conv_active ) {
195					window.gtag( 'config', fp.gads.id, { 'allow_enhanced_conversions': true } );
196				} else {
197					window.gtag( 'config', fp.gads.id );
198				}
199			}
200
201			load_gads();
202		}
203
204		if ( fp.loaded.includes('ga41') || fp.loaded.includes('gads') ) {
205			FP.runFn( 'FP.fns.load_gtg_footer' );
206		}
207	}
208
209})(window);

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.