1// This file will be run in the header on every page. 2// It should be used for content that relates 3// to your site as a whole, it should not be used for 4// plugin-specific js 5 6require(["site_gtm", "sv_load!plugins_dynamic_content"], function(gtm, dynamicContent) { 7 // site_gtm triggers the init of the library, binding dom events 8 // then we track the primary pageview 9 // if dynamic content is active, pass the user object with the pageview 10 if (dynamicContent) { 11 function getUserFields(fields, dcUser){ 12 let user = {}; 13 fields.some(function(field) { 14 if (dcUser?.[field]) user[field] = dcUser[field]; 15 }); 16 return user; 17 } 18 let user = getUserFields(["created", "type", "personas", "page_views"], dynamicContent.getUser()); 19 gtm.sendEvents({ 20 tClient_pageview : { dynamic_content: user }, 21 tCore_pageview : {} 22 }); 23 } else { 24 gtm.sendEvents({ 25 tClient_pageview : {}, 26 tCore_pageview : {} 27 }); 28 } 29});
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.