PluginProbe
Parse.ly / 2.5.1
Parse.ly v2.5.1
3.24.1 3.24.0 3.23.7 3.23.6 3.23.5 3.23.4 3.23.3 3.16.0 3.16.1 3.16.2 3.16.3 3.16.4 3.17.0 3.18.0 3.18.1 3.19.0 3.19.1 3.19.2 3.19.3 3.2.0 3.2.1 3.20.0 3.20.1 3.20.2 3.20.3 All 105 releases
wp-parsely / src / js / lib / init-api / index.js

index.js in Parse.ly 2.5.1, at src/js/lib/init-api/index.js

38 lines 809 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 async function uuidProfileCall() {
2 const apikey = global.wpParsely?.apikey;
3 const uuid = global.PARSELY?.config?.parsely_site_uuid;
4
5 if ( ! ( apikey && uuid ) ) {
6 return;
7 }
8
9 const url = `https://api.parsely.com/v2/profile?apikey=${ encodeURIComponent(
10 apikey
11 ) }&uuid=${ encodeURIComponent( uuid ) }&url=${ encodeURIComponent( window.location.href ) }`;
12
13 return fetch( url );
14 }
15
16 export function initApi() {
17 if ( typeof global.PARSELY === 'object' ) {
18 if ( typeof global.PARSELY.onload !== 'function' ) {
19 global.PARSELY.onload = uuidProfileCall;
20 return;
21 }
22 const oldonload = global.PARSELY.onload;
23 global.PARSELY.onload = function() {
24 if ( oldonload ) {
25 oldonload();
26 }
27 uuidProfileCall();
28 };
29 return;
30 }
31
32 global.PARSELY = {
33 onload: uuidProfileCall,
34 };
35 }
36
37 initApi();
38