Last active
October 17, 2016 17:08
-
-
Save tiffwu/d2a05044f9e8b99f723a3b6f921f0a13 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="tl_ad"></div> | |
<script> | |
try { | |
var inv_code = ""; | |
var pos = "%%PATTERN:domain%%" + "-" + "%%PATTERN:ctype%%" + "-" + "%%PATTERN:plat%%" + "-" + "%%PATTERN:id%%"; | |
var pos_map = [ | |
{ pos: "www.ew.com-homepage-desktop-enw_9", inv_code: "EW_main_feed" }, | |
{ pos: "www.ew.com-channel-desktop", inv_code: "EW_category_feed" }, | |
{ pos: "www.ew.com-article-desktop", inv_code: "EW_article_sub" }, | |
{ pos: "www.ew.com-homepage-desktop-enw_10", inv_code: "EW_homepage_photo_gallery" }, | |
{ pos: "www.ew.com-homepage-desktop-enw_11", inv_code: "EW_homepage_latest_videos" }, | |
{ pos: "www.ew.com-homepage-mobile-enw_5", inv_code: "EW_main_feed_mobile" }, | |
{ pos: "www.ew.com-channel-mobile", inv_code: "EW_category_feed_mobile" }, | |
{ pos: "www.ew.com-article-mobile", inv_code: "EW_article_sub_mobile" }, | |
{ pos: "www.ew.com-homepage-mobile-enw_3", inv_code: "EW_homepage_latest_videos_mobile" }, | |
{ pos: "www.sunset.com-channel-desktop", inv_code: "sunset_category_feed" }, | |
{ pos: "www.sunset.com-homepage-mobile", inv_code: "sunset_main_feed_mobile" }, | |
{ pos: "www.sunset.com-channel-mobile", inv_code: "sunset_category_feed_mobile" } | |
]; | |
for (var i = 0; i < pos_map.length; ++i) { | |
if (pos.indexOf(pos_map[i].pos) > -1) { | |
var inv_code = pos_map[i].inv_code; | |
} | |
} | |
if (!inv_code) { | |
throw new Error('no inv_code mapped to this ad slot'); | |
} | |
var click_tracker = "%%CLICK_URL_ESC%%"; // DFP macro | |
var prot = ""; | |
if (top.window.location.protocol == "https:") { | |
prot = "https:"; | |
} | |
var tl_script = document.createElement("script"); | |
var tl_src = prot + "//ib.3lift.com/ttj?inv_code=" + inv_code; | |
tl_script.src = tl_src; | |
document.getElementById("tl_ad").appendChild(tl_script); | |
} catch (e) { | |
var p = document.createElement('IMG'); | |
var ref = encodeURIComponent(document.URL); | |
p.src = "//eb2.3lift.com/sce?block=timeinc_js"+"&ref="+ref+"&lvl=2&inv_code="+inv_code+"&e="+encodeURIComponent(e); | |
p.width = 0; | |
p.height = 0; | |
document.body.appendChild(p); | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment