Coder Social home page Coder Social logo

meetrics-test-chorakchi's Introduction

Meetrics Code Challenge


that's function make the percentage of viewability in response and we can identify viewability and be counting the time we focused on the page and viewable place of the page about advertising.

function viewability (element, hasFocus) {
  var percentX =    (element.offsetWidth-Math.min(element.offsetWidth ,Math.max(0,window.scrollX-element.offsetLeft ))) * 100 /element.offsetWidth
  var percentY =    (element.offsetHeight-Math.min(element.offsetHeight ,Math.max(0,window.scrollY-element.offsetTop ))) * 100 /element.offsetHeight
   return hasFocus ? (((percentX * percentY) / 100 ).toFixed()) : 0
}

Other function for click counting.

function countCLick(event) {
  clickCounter++
}

The ad being viewable means:

  • The advertisement is 100% in the viewport of the browser (not viewable would be if the user scrolls to the bottom of the page)
  • The browser tab is opened (not viewable would be if you open some other page, e.g. facebook.com in another tab and the page looses its focus)

Goal:

  • Measure the viewability of the DIV that contains the ad
  • Determine viewability also by evaluating the windows focus state (tab change, window unfocused)
  • Log your results either to the console or render it on the page

Requirements:

  • You can use pure JavaScript or any library or a framework of your choice
  • Feel free to override the window.log function. This function is invoked every 500ms and should perform a simple console.log with your current viewability values.
  • Feel free to override the whole script.js if needed
  • Feel free to override the printStatus function - if you feel that you would like to display data in some other way that just logs in the console - you're more than welcome to do it!
  • The HTML structure of index.html file shouldn't be changed
  • Browser support at least one browser of your choice

Nice extras to have:

  • Measure the portion of the ad that is visible in %
  • Track clicks

Hints:

We value:

  • Clean, maintainable, well-documented code
  • Quality assurance of the code

Delivery:

Put your code in a git repository of your choice and send us the link.

meetrics-test-chorakchi's People

Contributors

chorakchi avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.