Skip to content

Instantly share code, notes, and snippets.

@cssimsek
Created June 18, 2018 10:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cssimsek/3da0087d1aa94a6c567915db1ec5f9e4 to your computer and use it in GitHub Desktop.
Save cssimsek/3da0087d1aa94a6c567915db1ec5f9e4 to your computer and use it in GitHub Desktop.
Lytics Audiences to DFP Integration JS - from https://goo.gl/CyUnFf
!function (l, a) {
a.liosetup = a.liosetup || {}, a.liosetup.callback = a.liosetup.callback || [], a.liosetup.addCallback = function (l) {
if ("function" == typeof a.liosetup.callback) {
var o = [];
o.push(a.liosetup.callback), a.liosetup.callback = o
}
a.lio && a.lio.loaded ? l(a.lio.data) : a.liosetup.callback.push(l)
}
}(document, window);
!function (o, g) {
g.googletag = g.googletag || {}, g.googletag.cmd = g.googletag.cmd || [], "undefined" != typeof g.googletag ? g.googletag.cmd.push(function () {
g.googletag.pubads().disableInitialLoad()
}) : console.warn("attempting to load Lytics for DFP before initializing googletag"), g.liosetup.callback.push(function (o) {
o || o.segments ? g.googletag.cmd.push(function () {
g.googletag.pubads().setTargeting("LyticsSegments", o.segments), g.googletag.pubads().refresh()
}) : (console.warn("unable to load Lytics audiences for DFP"), g.googletag.pubads().refresh())
})
}(document, window);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment