(function() {
'use strict';
// Prevent multiple initializations
if (window.adManagerInitialized) {
return;
}
window.adManagerInitialized = true;
class AdManager {
constructor() {
this.config = {
prebidTimeout: 1500,
cpmMarginPercent: parseInt(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;
// Initialize immediately
this.init().catch(error => {
this.log('AdManager initialization error:', error);
});
}
async init() {
try {
this.setupPreconnections();
this.setupAnalytics();
await this.waitForDocumentReady();
await this.loadScripts();
this.setupEventListeners();
this.setupFacebookPixel();
this.log('AdManager initialized successfully');
} catch (error) {
this.log('Error during initialization:', error);
}
}
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 => {
try {
const link = document.createElement('link');
link.rel = 'preconnect';
link.href = url;
document.head.appendChild(link);
} catch (error) {
this.log('Error adding preconnect for', url, error);
}
});
}
setupAnalytics() {
try {
window.assertiveQueue = window.assertiveQueue || [];
window.assertiveQueue.push(() => {
if (window.assertive && window.assertive.analytics && window.assertive.analytics.custom) {
window.assertive.analytics.custom.custom_6 = "AY_wrapper";
window.assertive.analytics.custom.custom_4 = 'Layout_' + (window.ads_layout || 'unknown');
}
});
} catch (error) {
this.log('Error setting up analytics:', error);
}
}
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);
});
}
loadAdWrapperScript() {
try {
const script = document.createElement("script");
script.src = "https://jk3yfTwHczNirJfKt.ay.delivery/manager/jk3yfTwHczNirJfKt";
script.referrerPolicy = "no-referrer-when-downgrade";
document.head.appendChild(script);
} catch (error) {
this.log('Error loading ad wrapper script:', error);
}
}
async loadScripts() {
try {
// 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;
} catch (error) {
this.log('Error loading scripts:', error);
}
}
setupFacebookNoscript() {
try {
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);
} catch (error) {
this.log('Error setting up Facebook noscript:', error);
}
}
async loadP1Script() {
return new Promise((resolve) => {
try {
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);
} catch (error) {
this.log('Error loading P1 script:', error);
resolve();
}
});
}
setupFacebookPixel() {
try {
// 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;
} catch (error) {
this.log('Error setting up Facebook pixel:', error);
}
}
setupEventListeners() {
try {
// Revenue tracking
window.addEventListener("assertive_predictedRevenue", (event) => {
this.handlePredictedRevenue(event);
}, false);
// Impression logging
window.addEventListener("assertive_logImpression", (event) => {
this.handleLogImpression(event);
});
} catch (error) {
this.log('Error setting up event listeners:', error);
}
}
handlePredictedRevenue(event) {
try {
const data = event.data;
if (!data || !data.predictedRevenueCPM) {
return;
}
let winnerCPM = data.predictedRevenueCPM.impression;
if (winnerCPM === 0) return;
this.log("assertive_predictedRevenue", window.assertive && window.assertive.analytics && window.assertive.analytics.custom ? window.assertive.analytics.custom.custom_6 : 'unknown', 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 ? data.meta.slotId : '',
};
// Determine winner and platform
const winnerInfo = this.determineWinner(data);
// Report to external systems
this.reportWin({
biddingPlatformId: winnerInfo.biddingPlatformId,
partnerAuctionId: data.meta ? data.meta.auctionId : '',
bidderCode: winnerInfo.winner,
prebidAuctionId: data.meta ? data.meta.auctionId : '',
cpm: winnerCPM,
currency: "USD",
originalCpm: winnerCPM,
originalCurrency: "USD",
status: "rendered",
placementId: data.meta ? data.meta.slotId : '',
});
// Send Facebook pixel event
if (typeof fbq !== "undefined") {
fbq("track", "Purchase", fbPixelData);
}
// Update analytics
this.updateAnalytics();
} catch (error) {
this.log('Error handling predicted revenue:', error);
}
}
determineWinner(data) {
let biddingPlatformId = 3; // Default to Google
let winner = "Google";
try {
if (data.meta && data.meta.dfpResponseInformation) {
const advertiserId = data.meta.dfpResponseInformation.advertiserId;
if (advertiserId === 4566943199) {
biddingPlatformId = 1; // Prebid
winner = data.meta.highestBid ? data.meta.highestBid.bidderCode : winner;
} else if (advertiserId === 4726541655) {
biddingPlatformId = 2; // Amazon
winner = "amazon";
}
}
} catch (error) {
this.log('Error determining winner:', error);
}
return { winner: winner, biddingPlatformId: biddingPlatformId };
}
sendPurchaseAggregatedValue(winnerCPM) {
try {
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();
} catch (error) {
this.log('Error sending purchase aggregated value:', error);
}
}
processSmallEvents() {
try {
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,
});
}
});
} catch (error) {
this.log('Error processing small events:', error);
}
}
processIncrementalEvents() {
try {
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,
});
}
} catch (error) {
this.log('Error processing incremental events:', error);
}
}
processMilestoneEvents() {
try {
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,
});
}
});
} catch (error) {
this.log('Error processing milestone events:', error);
}
}
sendCustomEvent(eventName, data) {
try {
if (typeof fbq !== "undefined") {
fbq("trackCustom", eventName, data);
}
if (typeof cis_send_custom_event !== "undefined") {
cis_send_custom_event(eventName, data);
}
} catch (error) {
this.log('Error sending custom event:', error);
}
}
handleLogImpression(event) {
try {
const payload = event.data ? event.data.payload : null;
if (!payload) return;
const mediaType = (payload.highestBid && 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;
}
} catch (error) {
this.log('Error handling log impression:', error);
}
}
reportWin(winData) {
try {
// Report to IntentIQ (if not Chrome)
if (!this.isChrome && typeof intentIq_612283370 !== "undefined" && intentIq_612283370.reportExternalWin) {
intentIq_612283370.reportExternalWin(winData);
}
} catch (error) {
this.log('Error reporting win:', error);
}
}
updateAnalytics() {
try {
if (typeof intentIq_612283370 !== "undefined" && intentIq_612283370.intentIqConfig) {
const testGroup = intentIq_612283370.intentIqConfig.abTesting ? intentIq_612283370.intentIqConfig.abTesting.currentTestGroup : null;
if (window.assertive && window.assertive.analytics && window.assertive.analytics.custom) {
window.assertive.analytics.custom.custom_8 = testGroup === "A" ? "IIQ_Enabled" : "IIQ_Disabled";
}
if (testGroup === "A") {
window.iiqCallbackMethod_init = true;
}
}
} catch (error) {
this.log('Error updating analytics:', error);
}
}
log() {
if (this.config.showLogs && typeof console !== 'undefined' && console.log) {
try {
console.log.apply(console, arguments);
} catch (e) {
// Silent fail if console is not available
}
}
}
}
// Initialize the ad manager
try {
window.adManager = new AdManager();
} catch (error) {
if (typeof console !== 'undefined' && console.error) {
console.error('Failed to initialize AdManager:', error);
}
}
// Add Impact site verification meta tag
try {
const metaTag = document.createElement('meta');
metaTag.name = 'impact-site-verification';
metaTag.content = 'bd46cba2-8f9e-4fd2-97e3-030369b052ff';
document.head.appendChild(metaTag);
} catch (error) {
if (typeof console !== 'undefined' && console.error) {
console.error('Failed to add meta tag:', error);
}
}
})();
History’s Juiciest and Intriguing Scandals
Khalid Elhassan - January 11, 2021
Nowadays, it is hard to pick up a newspaper or turn on the news without coming across scandal after scandal. Unfortunately – or fortunately – if you ascribe to the misery-loves company school of thought, scandals are nothing new, and have been around forever. But scandals from history come in a few different shades than scandals today. And there are some instances that would shock us more today than we’d think. Following are thirty things about some of history’s juicier scandals.
30. When America’s Favorite Good Girl Pushed Back at Her Wholesome Image
Lana Turner in her 1937 movie debut ‘They Won’t Forget’. Warner Bros.
In 1936, fifteen-year-old Julia Jean Turner skipped school to buy a Coca-Cola at LA’s Sunset Boulevard, when her beauty attracted the attention of a Hollywood reporter. When he asked if she was interested in acting, Turner replied: “I’ll have to ask my mother first “. Her mother, ailing and broke, jumped at the chance, and had her daughter sign up with Warner Bros. Studios. Within a few months, the novice actress (now screen-named Lana Turner) was a hit. Realizing that they had struck gold, the studio worked hard to protect Turner’s public image, and packaged and presented her as a wholesome bundle of American girl goodness.
Lana Turner. Wildfire Motion Pictures
To safeguard her reputation, Turner’s employers even hired chaperones to accompany her wherever she went. Unsurprisingly, the restrictions eventually began chafing at the young starlet, and she began pushing back. The result was a scandal, as Turner came to resent the bubble in which she was confined by MGM Studios, which took over her contract from Warner Bros. in 1938. As an escape, America’s favorite good girl began partying hard, and developed a taste for bad boys. The degree of badness grew over the years, as Turner gradually worked her from Hollywood tough guy poseurs to straight-up mobsters.