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="//a.realsrv.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://a.realsrv.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://a.realsrv.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>

Popunder Inline & remote script

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

    //version 1.0.0

    var adConfig = {
    "ads_host": "a.realsrv.com",
    "syndication_host": "syndication.realsrv.com",
    "idzone": 1234567,
    "popup_fallback": false,
    "popup_force": false,
    "chrome_enabled": true,
    "new_tab": false,
    "frequency_period": 30,
    "frequency_count": 1,
    "trigger_method": 3,
    "trigger_class": "",
    "only_inline": false,
    "t_venor": false,
    "tags": document.getElementsByName('keywords')[0].getAttribute('content')
};

Native

<script type="text/javascript">
let dataKeyword= document.getElementsByName('keywords')[0].getAttribute('content');
let s=document.createElement("script");
s.type = "text/javascript";
  s.src = "https://a.realsrv.com/nativeads-v2.js";
  s.setAttribute("data-idzone","1234567");
  s.setAttribute("data-keywords", dataKeyword);
  document.body.appendChild(s);
</script>

Video Slider

<script type="application/javascript" src="https://a.realsrv.com/video-slider.js"></script>

<script type="application/javascript">

var adConfig = {​​

    "idzone": 1234567,

    "frequency_period": 360,

    "close_after": 0,

    "on_complete": "repeat",

    "branding_enabled": 0,

    "screen_density": 30,

    "tags": document.getElementsByName('keywords')[0].getAttribute('content')

};

ExoVideoSlider.init(adConfig);

</script>

Outstream Video

 <script type="application/javascript">

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


  let r=document.createElement("script");

  r.type = "application/javascript";

    r.src = "https://a.realsrv.com/video-outstream.js";

    r.setAttribute("data-idzone","1234567");

    r.setAttribute("data-tags", dataKeyword);

    r.setAttribute("data-maximum_width","550")

    document.body.appendChild(r);

     </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://syndication.exosrv.com/splash.php?idzone=1234567&tags="+document.getElementsByName('keywords')[0].getAttribute('content')

                    },

                    {​​

                        "roll": "midRoll",

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

                        "timer": 8

                    },

                    {​​

                        "roll": "midRoll",

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

                        "timer": 10

                    },

                    {​​

                        "roll": "postRoll",

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

                    }

            ]

        }

}

    );

</script>
Sofya Kirillova

Sofya Kirillova