Hooks

Docs Hooks Pro · PHP hooks

modal_kit_pro_modal_events_per_hour

filter

Pro

PHP

Change how many Results events one modal can count per hour, from all visitors together. 20,000 by default.

Many addresses can each stay under the per-address limit, so this caps how far anyone can move one modal’s figures, and with them an A/B test. It runs for each event in a request, and the count lasts an hour from the modal’s first event.

Parameters

Parameter

Description

$limit

int

Events per modal per hour: 20000.

$modal_id

int

The modal ID the event names. It comes from the browser and is checked afterwards: events for a modal that isn’t published aren’t counted.

Returns

int The limit, cast to an integer. 0 or less refuses every event.

Example

A modal on a very busy shop

PHP

add_filter(
  'modal_kit_pro_modal_events_per_hour',
  function ( $limit, $modal_id ) {
    if ( 'black-friday' === get_post_field( 'post_name', $modal_id ) ) {
      return 200000;
    }

    return $limit;
  },
  10,
  2
);

Good to know

Events over the limit are dropped quietly: the request still succeeds.

Applied in modal-kit-pro/includes/Results.php.

Need a hook that isn’t here?