Skip to content

Commit

Permalink
Merge pull request #186 from readthedocs/davidfischer/ad-rotation-30s
Browse files Browse the repository at this point in the history
Lower ad rotation threshold to 30 seconds
  • Loading branch information
davidfischer committed Feb 13, 2024
2 parents 591ba07 + a5ddcfc commit 71f5fe6
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
2 changes: 1 addition & 1 deletion dist/ethicalads.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/ethicalads.min.js

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,20 @@ Be careful that the ad placement (``<div data-ea-publisher="...">``)
is not also removed by your screen transition or it will need to be recreated.


Automatic ad rotation
---------------------

.. note:: This feature is under active development and the conditions may change in future versions.

The ad client will automatically rotate an ad and show a new ad when appropriate.
Currently, the conditions for ad rotation are:

* The ad must be visible for 30 seconds or more.
* There must be a URL change (anchor link or using the `browser history API`_)

.. _browser history API: https://developer.mozilla.org/en-US/docs/Web/API/History_API


Customization
-------------

Expand Down
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import verge from "verge";

import "./styles.scss";

const AD_CLIENT_VERSION = "1.12.0"; // Sent with the ad request
const AD_CLIENT_VERSION = "1.13.0-alpha"; // Sent with the ad request

// For local testing, set this
// const AD_DECISION_URL = "http://ethicaladserver:5000/api/v1/decision/";
Expand Down Expand Up @@ -407,7 +407,7 @@ const VIEWPORT_FUDGE_FACTOR = -3; // px
// And there is user interaction.
// We rotate no more than the maximum number of rotations.
// Loading the ad the first time counts as the first rotation.
const MIN_VIEW_TIME_ROTATION_DURATION = 60; // seconds
const MIN_VIEW_TIME_ROTATION_DURATION = 30; // seconds
const MAX_ROTATIONS = 3;

/* Placement object to query decision API and return an Element node
Expand Down

0 comments on commit 71f5fe6

Please sign in to comment.