/**
* Ad Management and Tracking Script
* Handles ad wrapper selection, Facebook pixel tracking, and revenue reporting
*/
class AdManager {
constructor() {
this.config = {
prebidTimeout: 1500,
cpmMarginPercent: window.cpmMarginPercent || 0,
showLogs: window.cis_show_logs || false
};
this.pixel = {
adsAmountValue: 0,
lastSentValue: 0,
eventFired: 0,
smallEventFired: 0,
smallEvents: [1, 2, 2.5, 3, 4, 5, 6, 7, 7.5, 8, 9]
};
this.doneAuctionsWins = window.doneAuctionsWins || [];
this.isChrome = /Chrome/.test(navigator.userAgent) && /Google Inc/.test(navigator.vendor);
this.isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;
this.init();
}
/**
* Initialize the ad manager
*/
async init() {
this.setupPreconnections();
this.setupAnalytics();
await this.waitForDocumentReady();
await this.loadScripts();
this.setupEventListeners();
this.setupFacebookPixel();
}
/**
* Setup DNS preconnections for better performance
*/
setupPreconnections() {
const preconnectUrls = [
'https://fonts.gstatic.com',
'https://adservice.google.com',
'https://tpc.googlesyndication.com',
'https://securepubads.g.doubleclick.net',
'https://pagead2.googlesyndication.com',
'https://pubads.g.doubleclick.net',
'https://www.google-analytics.com',
'https://www.googletagservices.com',
'https://c.amazon-adsystem.com',
'https://aax.amazon-adsystem.com',
'https://connect.facebook.net'
];
preconnectUrls.forEach(url => {
const link = document.createElement('link');
link.rel = 'preconnect';
link.href = url;
document.head.appendChild(link);
});
}
/**
* Setup analytics custom variables
*/
setupAnalytics() {
window.assertiveQueue = window.assertiveQueue || [];
window.assertiveQueue.push(() => {
if (window.assertive?.analytics?.custom) {
window.assertive.analytics.custom.custom_6 = "AY_wrapper";
window.assertive.analytics.custom.custom_4 = `Layout_${window.ads_layout}`;
}
});
}
/**
* Wait for document to be ready
*/
async waitForDocumentReady() {
return new Promise((resolve) => {
if (document.readyState === "interactive" || document.readyState === "complete") {
resolve();
return;
}
const checkInterval = setInterval(() => {
if (document.readyState === "interactive" || document.readyState === "complete") {
clearInterval(checkInterval);
resolve();
}
}, 20);
});
}
/**
* Load AY ad wrapper script
*/
loadAdWrapperScript() {
const script = document.createElement("script");
script.src = "https://jk3yfTwHczNirJfKt.ay.delivery/manager/jk3yfTwHczNirJfKt";
script.referrerPolicy = "no-referrer-when-downgrade";
document.head.appendChild(script);
}
/**
* Load required scripts
*/
async loadScripts() {
// Load ad wrapper
this.loadAdWrapperScript();
// Load Facebook pixel noscript
this.setupFacebookNoscript();
// Load P1 script
await this.loadP1Script();
// Set prebid timeout
window.PREBID_TIMEOUT = this.config.prebidTimeout;
}
/**
* Setup Facebook pixel noscript fallback
*/
setupFacebookNoscript() {
const noscript = document.createElement("noscript");
const img = document.createElement("img");
img.height = "1";
img.width = "1";
img.style.display = "none";
img.src = "https://www.facebook.com/tr?id=1581007252192655&ev=PageView&noscript=1";
noscript.appendChild(img);
document.head.appendChild(noscript);
}
/**
* Load P1 script and wait for it to be ready
*/
async loadP1Script() {
return new Promise((resolve) => {
const script = document.createElement("script");
script.id = "script_p1";
script.src = "https://cdn.historycollection.com/wp-content/uploads/2024/03/p1.js";
script.onload = () => resolve();
script.onerror = () => resolve(); // Continue even if script fails
document.head.appendChild(script);
// Fallback timeout
setTimeout(resolve, 5000);
});
}
/**
* Setup Facebook pixel tracking
*/
setupFacebookPixel() {
// Initialize pixel globals
window.pixel_ads_amount_value = this.pixel.adsAmountValue;
window.pixel_last_sent_value = this.pixel.lastSentValue;
window.pixel_event_fired = this.pixel.eventFired;
window.pixel_small_event_fired = this.pixel.smallEventFired;
window.pixel_small_events = this.pixel.smallEvents;
}
/**
* Setup event listeners for ad tracking
*/
setupEventListeners() {
// Revenue tracking
window.addEventListener("assertive_predictedRevenue", (event) => {
this.handlePredictedRevenue(event);
}, false);
// Impression logging
window.addEventListener("assertive_logImpression", (event) => {
this.handleLogImpression(event);
});
}
/**
* Handle predicted revenue events
*/
handlePredictedRevenue(event) {
const { data } = event;
let winnerCPM = data.predictedRevenueCPM.impression;
if (winnerCPM === 0) return;
this.log("assertive_predictedRevenue", window.assertive?.analytics?.custom?.custom_6, winnerCPM);
// Update aggregated value and send pixel events
this.sendPurchaseAggregatedValue(winnerCPM);
// Apply margin if configured
if (this.config.cpmMarginPercent > 0) {
winnerCPM = winnerCPM - (winnerCPM * this.config.cpmMarginPercent) / 100;
}
if (winnerCPM < 0) return;
// Prepare Facebook pixel data
const fbPixelData = {
value: winnerCPM,
currency: "USD",
content_ids: window.location.href.split("/")[3],
content_type: "Product",
bidder: "Google",
adUnit: data.meta.slotId,
};
// Determine winner and platform
const { winner, biddingPlatformId } = this.determineWinner(data);
// Report to external systems
this.reportWin({
biddingPlatformId,
partnerAuctionId: data.meta.auctionId,
bidderCode: winner,
prebidAuctionId: data.meta.auctionId,
cpm: winnerCPM,
currency: "USD",
originalCpm: winnerCPM,
originalCurrency: "USD",
status: "rendered",
placementId: data.meta.slotId,
});
// Send Facebook pixel event
if (typeof fbq !== "undefined") {
fbq("track", "Purchase", fbPixelData);
}
// Update analytics
this.updateAnalytics();
}
/**
* Determine auction winner and platform
*/
determineWinner(data) {
let biddingPlatformId = 3; // Default to Google
let winner = "Google";
if (data.meta.dfpResponseInformation) {
const advertiserId = data.meta.dfpResponseInformation.advertiserId;
if (advertiserId === 4566943199) {
biddingPlatformId = 1; // Prebid
winner = data.meta.highestBid.bidderCode;
} else if (advertiserId === 4726541655) {
biddingPlatformId = 2; // Amazon
winner = "amazon";
}
}
return { winner, biddingPlatformId };
}
/**
* Send aggregated purchase value to pixel
*/
sendPurchaseAggregatedValue(winnerCPM) {
this.pixel.adsAmountValue += winnerCPM;
window.pixel_ads_amount_value = this.pixel.adsAmountValue;
if (typeof fbq === "undefined") return;
// Process small events
this.processSmallEvents();
// Process $10 increments
this.processIncrementalEvents();
// Process milestone events
this.processMilestoneEvents();
}
/**
* Process small increment events
*/
processSmallEvents() {
this.pixel.smallEvents.forEach((threshold, index) => {
if (this.pixel.smallEventFired <= index && this.pixel.adsAmountValue > threshold) {
this.pixel.smallEventFired++;
window.pixel_small_event_fired = this.pixel.smallEventFired;
const eventName = `${threshold / 10}R${window.site_prefix}`;
this.sendCustomEvent(eventName, {
currency: "USD",
value: threshold,
});
}
});
}
/**
* Process $10 incremental events
*/
processIncrementalEvents() {
while (
this.pixel.adsAmountValue > 10 &&
this.pixel.adsAmountValue < 310 &&
this.pixel.adsAmountValue > this.pixel.lastSentValue + 10
) {
this.pixel.lastSentValue += 10;
window.pixel_last_sent_value = this.pixel.lastSentValue;
const eventName = `${this.pixel.lastSentValue / 10}R${window.site_prefix}`;
this.sendCustomEvent(eventName, {
currency: "USD",
value: this.pixel.lastSentValue,
});
}
}
/**
* Process milestone events ($30, $50, $80, $100)
*/
processMilestoneEvents() {
const milestones = [
{ threshold: 30, event: "HC_30" },
{ threshold: 50, event: "HC_50" },
{ threshold: 80, event: "HC_80" },
{ threshold: 100, event: "HC_100" }
];
milestones.forEach((milestone, index) => {
if (this.pixel.adsAmountValue > milestone.threshold && this.pixel.eventFired === index) {
this.pixel.eventFired++;
window.pixel_event_fired = this.pixel.eventFired;
this.sendCustomEvent(milestone.event, {
currency: "USD",
value: this.pixel.adsAmountValue,
});
}
});
}
/**
* Send custom event to Facebook and internal tracking
*/
sendCustomEvent(eventName, data) {
if (typeof fbq !== "undefined") {
fbq("trackCustom", eventName, data);
}
if (typeof cis_send_custom_event !== "undefined") {
cis_send_custom_event(eventName, data);
}
}
/**
* Handle log impression events
*/
handleLogImpression(event) {
const payload = event.data.payload;
const mediaType = payload?.highestBid?.mediaType || "banner";
if (payload.unfilled || payload.sourceInternal !== "gpt") {
return;
}
// Apply iOS bias for banner ads
if (mediaType === "banner" && this.isIOS) {
payload.revenueBias = 0.975;
}
}
/**
* Report win to external systems
*/
reportWin(winData) {
// Report to IntentIQ (if not Chrome)
if (!this.isChrome && typeof intentIq_612283370 !== "undefined") {
intentIq_612283370.reportExternalWin(winData);
}
}
/**
* Update analytics based on IntentIQ configuration
*/
updateAnalytics() {
if (typeof intentIq_612283370 !== "undefined" && intentIq_612283370.intentIqConfig) {
const testGroup = intentIq_612283370.intentIqConfig.abTesting.currentTestGroup;
if (window.assertive?.analytics?.custom) {
window.assertive.analytics.custom.custom_8 = testGroup === "A" ? "IIQ_Enabled" : "IIQ_Disabled";
}
if (testGroup === "A") {
window.iiqCallbackMethod_init = true;
}
}
}
/**
* Utility logging method
*/
log(...args) {
if (this.config.showLogs) {
console.log(...args);
}
}
/**
* Send event to internal API
*/
sendToApi(eventName) {
if (typeof cis_send_to_api !== "undefined") {
cis_send_to_api(eventName);
}
}
}
// Initialize the ad manager
const adManager = new AdManager();
// Add Impact site verification meta tag
const metaTag = document.createElement('meta');
metaTag.name = 'impact-site-verification';
metaTag.content = 'bd46cba2-8f9e-4fd2-97e3-030369b052ff';
document.head.appendChild(metaTag);
16 Facts that Prove Rosslyn Chapel is the World’s Captivating Chapel
Trista - November 23, 2018
One of the most iconic buildings in the world is the enigmatic Rosslyn Chapel, a small church building during the fifteenth century just a few miles south of Scotland’s capital city, Edinburgh. What interests some people are the stone carvings that cover the chapel’s entire interior surface, and much of its exterior, as well. For others, the intrigue lays in the stories that are told about the chapel. Some have said that its founder was trying to leave a message for future generations to one day decipher. After all, the chapel was built during a time when illiteracy in Europe was high, and book-burning was common, so he left a message in stone that many people now are trying to understand.
16. William Sinclair Built Rosslyn Chapel in 1446
Drawing of the interior of Rosslyn Chapel. mythormorph.
Very little is known about the people who actually constructed Rosslyn Chapel, particularly the stonemasons who created the intricate carvings that line both the interior and the exterior of the building. For many people, the whole place is shrouded in mystery, as its engravings have themes that are Christian, pagan, and even Masonic, though the chapel was built centuries before the organization known as the Freemasons came into existence. Much of its grandeur comes not from the building itself but the stories emanating from it.
One thing that is known is that it was originally founded in 1446 by a man named William Sinclair, who was the Prince of Orkney. Many of the documents relating to his own life and the origins of the chapel were destroyed in a fire, but some are preserved at the National Scottish Library in nearby Edinburgh. They show that the set out to construct a marvelous building and that he paid his workers quite handsomely – regular masons received a salary of 10 pounds per year, equivalent to 50,000 pounds today, far above today’s living wage. Master masons earned as much as 40 pounds a year, 200,000 pounds in today’s money.