Using UniConsent Script (UnicScript) to manage on page elements

You can manage the on-page elements with UnicScript and load the tag based on the consent of purpose ID or custom vendor ID. (IAB TCF 2.2 Purposes)

Purpose IDDescription
1Store and/or access information on a device
2Use limited data to select advertising
3Create profiles for personalised advertising
4Use profiles to select personalised advertising
5Create profiles to personalise content
6Use profiles to select personalised content
7Measure advertising performance
8Measure content performance
9Understand audiences through statistics or combinations of data from different sources
10Develop and improve services
11Use limited data to select content

Example:

<script type="text/unicscript" unic-purpose-id="1">
  console.log('hello purpose 1');
</script>

Example 2:

<script type="text/unicscript" unic-purpose-id="1" src="xxxxx"></script>

Example:

<script type="text/unicscript" unic-purpose-ids="1,2,3">
  console.log('hello purpose 1,2,3');
</script>

Example:

<script type="text/unicscript" unic-vendor-id="1">
  console.log('hello vendor 1');
</script>

Example 2:

<script type="text/unicscript" unic-vendor-id="1" src="xxxxx"></script>

Example:

<iframe
  data-unicscript
  unic-purpose-id="1"
  width="560"
  height="315"
  data-src="https://www.youtube.com/embed/XXXX"
  frameborder="0"
  allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture"
  allowfullscreen
></iframe>

Example:

<iframe
  data-unicscript
  unic-purpose-id="1,2,3"
  width="560"
  height="315"
  data-src="https://www.youtube.com/embed/XXXX"
  frameborder="0"
  allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture"
  allowfullscreen
></iframe>

Example:

<iframe
  unic-vendor-id="1"
  width="560"
  height="315"
  data-src="https://www.youtube.com/embed/XXXX"
  frameborder="0"
  allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture"
  allowfullscreen
></iframe>

Manage Google Adsense with UnicScript

Change:

<script
  async
  src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"
  type="text/javascript"
></script>

to be:

<script
  async
  src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"
  unic-purpose-id="3"
  type="text/unicscript"
></script>

Modify the Google Adsense ad slot tag adding on page, change:

<ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-XXXXXX" data-ad-slot="XXXXXXX" data-ad-format="auto" data-full-width-responsive="true"></ins>
<script type="text/javascript">
(adsbygoogle = window.adsbygoogle || []).push({});
</script>

to be:

<ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-XXXXXX" data-ad-slot="XXXXXXX" data-ad-format="auto" data-full-width-responsive="true"></ins>
<script type="text/unicscript" unic-purpose-id="3" >
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>

Still have questions?

Contact us: support@uniconsent.com