PageSourceSearch

https://www.2gb.com/wp-content/themes/ucms/assets/js/dgam-config.js?ver=1790223043

js 2gb.com collected 2026-09-24 09:01:05 UTC 4,381 bytes, 150 lines download raw bytes

1// This contains the DGAM ads config specific for our News Talk sites
2// The DGAM config is called on initial page load and when pjaxy templates are loaded
3
4function dgamConfig() {
5  var pageviewIdGen = function () {
6    var chars =
7      "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(
8        ""
9      );
10    var uuid = [];
11    var i, r;
12    var radix = chars.length;
13    // rfc4122 requires these characters
14    uuid[8] = uuid[13] = uuid[18] = uuid[23] = "-";
15    uuid[14] = "4";
16    // Fill in random data.  At i==19 set the high bits of clock sequence as
17    // per rfc4122, sec. 4.1.5
18    for (i = 0; i < 36; i++) {
19      if (!uuid[i]) {
20        r = 0 | (Math.random() * 16);
21        uuid[i] = chars[i == 19 ? (r & 0x3) | 0x8 : r];
22      }
23    }
24    // Declare a global variable for page.viewID.js
25    window.pageviewIDjs = uuid.join("");
26  };
27  pageviewIdGen();
28
29  var initDataLayer = function () {
30    // Determine viewport size
31    var windowWidth = window.innerWidth;
32    var devices = {
33      mobile: {
34        breakpoint: 970,
35        adSlots: digitalData.titan.mobileAds,
36      },
37      tablet: {
38        breakpoint: 1219,
39        adSlots: digitalData.titan.tabletAds,
40      },
41      desktop: {
42        adSlots: digitalData.titan.desktopAds,
43      },
44    };
45    var device = "desktop";
46    if (windowWidth <= devices.mobile.breakpoint) {
47      device = "mobile";
48    } else if (
49      windowWidth > devices.mobile.breakpoint &&
50      windowWidth <= devices.tablet.breakpoint
51    ) {
52      device = "tablet";
53    }
54
55    // Is the page a listing or a single post/page?
56    var pageType;
57    if (document.body.classList.contains("single")) {
58      pageType = "Single";
59    } else {
60      pageType = "Index";
61    }
62
63    // Converts adSlotIds into correct format for DGAM Adkit
64    function transformAdSlots(adSlotIds) {
65      return adSlotIds.map((id) => {
66        // Extract the position number
67        const posMatch = id.match(/-pos(\d+)$/);
68        const pos = posMatch ? parseInt(posMatch[1], 10) : null;
69
70        // Extract the sizes
71        const sizeMatch = id.match(/adspot-(.+)-pos\d+$/);
72        const sizes = sizeMatch
73          ? sizeMatch[1].split("_").map((size) => size.split("x").map(Number))
74          : [];
75
76        return {
77          id: id,
78          size: sizes,
79          pos: pos,
80          lazy: pos > 1,
81          allow_smaller_sizes: true,
82          foldPosition: pos == 1 ? "above" : "below",
83          native: false,
84        };
85      });
86    }
87
88    // Map titan data to DGAM data layer
89    const hierarchyData = {
90      level1: player_data["titanIdentity"],
91      level2: "",
92      level3: "",
93      level4: "",
94    }
95
96
97    if(typeof digitalData.titan.adKeyValues.cat !== undefined && digitalData.titan.adKeyValues.cat !== '') {
98      // Remove the 'space' character from the category
99      const cat = digitalData.titan.adKeyValues.cat
100      hierarchyData.level2 = digitalData.titan.adKeyValues.cat.trim().replace(/\s/g, '_');
101    }
102
103    if(typeof digitalData.titan.adKeyValues.cat1 !== undefined && digitalData.titan.adKeyValues.cat1 !== '') {
104      hierarchyData.level3 = digitalData.titan.adKeyValues.cat1.trim().replace(/\s/g, '_');
105    }
106
107    // Level 4 is not being used
108
109    // DGAM data layer
110    window.dataLayerHybrid = {
111      adserving: {
112        brand: player_data["titanIdentity"],
113        ads: transformAdSlots(devices[device].adSlots),
114        keywords: {
115          hierarchy: hierarchyData,
116          tags: [],
117          pageType: digitalData.titan.adKeyValues.ctype,
118        },
119        pageViewId: window.pageviewIDjs,
120        adSuppression: false,
121        breakpoint: window.innerWidth,
122      },
123      page: {
124        author: "",
125        brand: "nine_radio",
126        effectiveDate: "",
127        generator: "EF",
128        issueDate: "",
129        pageID: digitalData.titan.adKeyValues.pageId,
130        pageName: document.title,
131        pageType: pageType,
132        primaryCategory: digitalData.titan.adKeyValues.cat,
133        sysEnv: device,
134        viewID: window.pageviewIDjs,
135      },
136      user: {
137        profileID: "",
138        memberType: "visitor",
139      },
140    };
141    if (
142      typeof helper_funcs === "object" &&
143      helper_funcs.check_for_nuid_cookie()
144    ) {
145      window.dataLayerHybrid.adserving.keywords.nuid =
146        helper_funcs.check_for_nuid_cookie();
147    }
148  };
149  initDataLayer();
150}

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.