Logo

What are you looking for?

Get help straight from our team...

Can I serve Sulvo tags through Google Tag Manager (GTM)?

Ad Information

Can I serve Sulvo tags through Google Tag Manager (GTM)?

Last updated on 11 May, 2022

Yes!

For the best results and access to all features, Sulvo still recommends placing our tags directly on the page. However, if this is not possible, Sulvo tags can be implemented through Google Tag Manager with a slight modification.

Required Tag Modification

This is the only condition in which Sulvo supports modifying the tags. Modifying tags in any other use case is not supported.

To serve Sulvo tagless units through Google Tag Manager please make the following change to the head tag only:

Standard head tag:

&lt;link rel="preload" as="script" href="https://live.demand.supply/up.js"&gt;<br>   &lt;script async data-cfasync="false" type="text/javascript" <br>      src="https://live.demand.supply/up.js"&gt;&lt;/script&gt;

Head tag to be used in Google Tag Manager:

&lt;script async data-cfasync="false" type="text/javascript" <br>   src="https://live.demand.supply/up.js"&gt;&lt;/script&gt;

With the above modification the following Sulvo formats may be used:

  • Tagless stickies (desktop and mobile)

  • Interstitials

How to use Fluid, Native (Multi), and standard sticky (units requiring head and body tags) units with GTM:

If you would like to serve Fluid, Native (Multi), and standard sticky (units requiring head and body tags) units with Google Tag Manager, in addition to the above modification, you will need to put the ad name, the devices, and the element above where you want the ad to be placed (only for non-sticky units), with one entry per ad unit.

In this example the following line is dynamic per ad unit:

setupAd('example.com_responsive_r_right', 'm:0,t:1,d:1', <br>'sampleDivId1')

 

Example tag to load a Fluid ad unit in `DivID1`:

&lt;script async data-cfasync="false" type="text/javascript" <br>   src="https://live.demand.supply/up.js"&gt;&lt;/script&gt;

&lt;script type="text/javascript"&gt;
onDomReady(function () {
&nbsp; // In-content units need a reference to the element that will be <br>    above them.
&nbsp; setupAd('example.com_responsive_r_right', 'm:0,t:1,d:1', <br>    'sampleDivId1')
&nbsp; // Sticky units don't need the reference, since they float on <br>    top of content.
&nbsp; setupAd('example.com_sticky_display_bottom', 'm:0,t:0,d:1')
})

function setupAd (adName, devices, elementAboveId) {
&nbsp; var adDiv = document.createElement('div')
&nbsp; adDiv.dataset.ad = adName
&nbsp; adDiv.dataset.devices = devices
&nbsp; adDiv.classList.add('demand-supply')

&nbsp; // Sticky units don't need an elementAboveId.
&nbsp; if (elementAboveId) {
&nbsp; &nbsp; var aboveTarget = document.getElementById(elementAboveId)
&nbsp; &nbsp; aboveTarget.parentNode.insertBefore(adDiv, aboveTarget.nextSibling)
&nbsp; } else {
&nbsp; &nbsp; window.body.appendChild(adDiv)
&nbsp; }

&nbsp; window.demandSupply &amp;&amp; demandSupply.surge &amp;&amp; demandSupply.surge.displayAd(adName)
}  &nbsp; <br><br>function onDomReady (callback) {
&nbsp; if (['interactive', 'complete'].includes(document.readyState)) {
&nbsp; &nbsp; callback()
&nbsp; } else {
&nbsp; &nbsp; window.document.addEventListener('DOMContentLoaded', callback)
&nbsp; }
}
&lt;/script&gt;

 

Did you find this article helpful?
Previous

Should I cache the Sulvo scripts to increase pagespeed?

Next