Publishers! How to automate keyword extraction from meta tags

How to automate the keyword extraction from page meta tags

Do you have meta tags within your web pages? Did you know that keywords allow you to help attract advertisers to target your ad zones. Many advertisers use keyword targeting when setting up their campaigns to help them find ad zones that display similar content to the theme of their offer, to make their ads fit more contextually into a site. If an end user sees an ad for an offer that is related to content they have searched for on your website, the end user is more likely to click on the ad, bringing more qualified clicks for the advertiser and bringing you a higher CTR for that ad zone. For example, say you have a piece of video content that shows a couple going out for a date, you could add the keyword ‘Dating’ to the video ad zone, this will attract advertisers with Dating offers to bid for your ad zone. Now Dating advertisers will be more likely to bid for your ad zone, which will create more competition, increasing your eCPM values.  

You can manually insert keywords as ‘tags’ for your ad zone, which is explained in this documentation.

But did you know that you can also automatically extract keywords from your webpage and place them in your ad zones? This saves time and is a simple process which I will explain to you in this tutorial.

What are Meta Keywords? 

Meta Keywords are a specific type of meta tag that can be added in the <head> HTML code on a website, many publishers use Meta Keywords on their website to define the main keywords of the website’s content. Here is an example showing Meta keywords for general, humour, games and gif:

Metaname example

How to automatically extract Meta Keywords and add them to ad zone tags

Below are examples for several different ExoClick ad formats. Each code example will create a custom integration that will automatically pull keywords from the meta keywords tag on your website and insert them as the ‘tags‘ (keywords) into the ad zone code. Add each code within the <body> tags of the page. Please note: This will only work if you are using a meta keyword tag on your website:

Banner (iframe)

<iframe id="myIframe" src="//adservingdomain.com/iframe.php?idzone=1234567&size=300x250" width="300" height="250" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe>

<script>

let dataKeyword= document.getElementsByName('keywords')[0].getAttribute('content');

document.getElementById('myIframe').src=(document.getElementById('myIframe').src+"&tags="+dataKeyword);

</script>

Banner Asynchronous Script

<script async type="application/javascript" src="https://adservingdomain.com/ad-provider.js"></script> 

 <ins class="adsbyexoclick" data-zoneid="1234567"></ins> 

 <script>

    (AdProvider = window.AdProvider || []).push({"serve": {}});

    let dataKeyword= document.getElementsByName('keywords')[0].getAttribute('content');    var dataElements = document.getElementsByClassName("adsbyexoclick");

for (var i=0; i<dataElements.length; i++) {dataElements[i].setAttribute("data-keywords",dataKeyword);}


</script>

Multi-format

<script async type="application/javascript" src="https://adservingdomain.com/ad-provider.js"></script>
    <ins class="eas6a97888e" data-zoneid="1234567"></ins>
<script>
  (AdProvider = window.AdProvider || []).push({"serve": {}});
  let dataKeyword= document.getElementsByName('keywords')[0].getAttribute('content');
  var dataElements = document.getElementsByClassName("eas6a97888e");
  for (var i=0; i<dataElements.length; i++) {dataElements[i].setAttribute("data-keywords",dataKeyword);}
</script>

Popunder Inline & remote script

<script type="application/javascript">
(function() {

    //version 1.0.0

    var adConfig = {
    "ads_host": "adservingdomain.com",
    "syndication_host": "adservingdomain.com",
    "idzone": 2901672,
    "popup_fallback": true,
    "popup_force": false,
    "chrome_enabled": true,
    "new_tab": false,
    "frequency_period": 5,
    "frequency_count": 1,
    "trigger_method": 3,
    "trigger_class": "",
    "trigger_delay": 0,
    "only_inline": false,
    "tags": document.getElementsByName('keywords')[0].getAttribute('content')
};

Native

<script async type="application/javascript" src="https://adservingdomain.com/ad-provider.js"></script>
    <ins class="eas6a97888e" data-zoneid="1234567"></ins>
<script>
  (AdProvider = window.AdProvider || []).push({"serve": {}});
  let dataKeyword= document.getElementsByName('keywords')[0].getAttribute('content');
  var dataElements = document.getElementsByClassName("eas6a97888e");
  for (var i=0; i<dataElements.length; i++) {dataElements[i].setAttribute("data-keywords",dataKeyword);}
</script>

Video Slider

<script type="application/javascript" src="adservingdomain.com/video-slider.js"></script>
<script type="application/javascript">
var adConfig = {
    "idzone": 1234567,
    "frequency_period": 5,
    "close_after": 5,
    "on_complete": "repeat",
    "screen_density": 25,
    "cta_enabled": 0,
    "tags": document.getElementsByName('keywords')[0].getAttribute('content')
};
VideoSlider.init(adConfig);
</script>

Outstream Video

<script async type="application/javascript" src="https://adservingdomain.com/ad-provider.js"></script>
    <ins class="eas6a97888e" data-zoneid="1234567"></ins>
<script>
  (AdProvider = window.AdProvider || []).push({"serve": {}});
  let dataKeyword= document.getElementsByName('keywords')[0].getAttribute('content');
  var dataElements = document.getElementsByClassName("eas6a97888e");
  for (var i=0; i<dataElements.length; i++) {dataElements[i].setAttribute("data-keywords",dataKeyword);}
</script>

In-Stream Video (with Fluid Player)

<link rel="stylesheet" href="https://cdn.fluidplayer.com/v2/current/fluidplayer.min.css" type="text/css"/>

<script src="https://cdn.fluidplayer.com/v3/current/fluidplayer.min.js"></script>


<video id="my-video" controls="" style="width: 640px; height: 360px;">

    <source src="main_video.mp4" type="video/mp4">

</video>


<script type="application/javascript">

    var testVideo = fluidPlayer(

        "my-video",

        {

            vastOptions: {

                "adList": [

                    {

                        "roll": "preRoll",

                        "vastTag": "https://adservingdomain.com/splash.php?idzone=1234567&tags="+document.getElementsByName('keywords')[0].getAttribute('content')

                    },

                    {

                        "roll": "midRoll",

                        "vastTag": "https://adservingdomain.com/splash.php?idzone=1234567&tags="+document.getElementsByName('keywords')[0].getAttribute('content'),

                        "timer": 8

                    },

                    {

                        "roll": "midRoll",

                        "vastTag": "https://adservingdomain.com/splash.php?idzone=1234567&tags="+document.getElementsByName('keywords')[0].getAttribute('content'),

                        "timer": 10

                    },

                    {

                        "roll": "postRoll",

                        "vastTag": "https://adservingdomain.com/splash.php?idzone=1234567&tags="+document.getElementsByName('keywords')[0].getAttribute('content')

                    }

            ]

        }

}

    );

</script>

Sofya Kirillova