PageSourceSearch

https://buzzsumo.com/wp-content/themes/brandwatch/templates/header/at-load.js?ver=1697612669

js buzzsumo.com collected 2026-09-24 06:56:38 UTC 2,444 bytes, 62 lines download raw bytes

1// NB - we have to wrap all this in our cookie consent check
2//    - and this is client-side because the cookie check cannot run server side due to server side caching
3
4var initial__location = global_get_geo_cookie();
5var initial__is_gdpr = initial__location && global_is_gdpr_country(initial__location);
6var approval_cookie = global_get_cookie('bw_cookies__strict__approved__statistical');
7
8// BuzzSumo
9var tracking_prefs_cookies = global_get_cookie('tracking-preferences');
10
11function global_load_optimizely() {
12  const script = document.createElement('script')
13  script.src = location.href.includes('brandwatch') ? 'https://cdn.optimizely.com/js/20151573008.js' : 'https://cdn.optimizely.com/js/20134236241.js';
14  script.setAttribute('defer', '');
15  const head = document.querySelector('head')
16  head.insertBefore(script, head.firstChild)
17}
18
19if (tracking_prefs_cookies) {
20  try {
21    var prefs = JSON.parse(decodeURIComponent(tracking_prefs_cookies));
22
23    if (prefs.destinations.Optimizely) {
24      global_load_optimizely();
25    }
26    if (prefs.custom.advertising) {
27      // StackAdapt 
28      !function (s, a, e, v, n, t, z) { if (s.saq) return; n = s.saq = function () { n.callMethod ? n.callMethod.apply(n, arguments) : n.queue.push(arguments) }; if (!s._saq) s._saq = n; n.push = n; n.loaded = !0; n.version = '1.0'; n.queue = []; t = a.createElement(e); t.async = !0; t.src = v; z = a.getElementsByTagName(e)[0]; z.parentNode.insertBefore(t, z) }(window, document, 'script', 'https://tags.srv.stackadapt.com/events.js'); saq('ts', '4V3ykr5otncxjlQiCMMu6A');
29    }
30  } catch (e) { }
31}
32
33// If approval_cookie is N, user is gdpr and has previously rejected the scripts
34if (approval_cookie === 'N') {
35  // do nothing
36}
37
38// If approval_cookie has been previously set to Y, user must be gdpr and previously accepted
39else if (approval_cookie === 'Y') {
40  global_load_optimizely();
41
42
43}
44
45// else if (approval_cookie === null) {
46  // If we know the location and the user is not gdpr, can load immediately
47  // if (initial__location && !initial__is_gdpr) {
48   //  global_load_optimizely();
49  // }
50
51  // If we don't yet know the location, get location and then load if user is not gdpr
52  // else {
53    // window.global_geo_ip_promise
54      // .then(function (location) {
55        // var is_gdpr_region = global_is_gdpr_country(location);
56        // if (!is_gdpr_region) {
57         //  global_load_optimizely();
58       //  }
59      // });
60  //}
61// }
62

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.