Home > widget-integration > CountdownTimerAPI > getTimerForScope

CountdownTimerAPI.getTimerForScope() method

Fetch the countdown timer for an explicit placement scope.

Unlike , this does not auto-detect the scope from the current page — the caller provides it directly. Used by cart drawer integration where the timer scope is independent of the page type.

Signature:

getTimerForScope(timerScope: CountdownPlacement): Promise<CountdownCampaign | null>;

Parameters

Parameter

Type

Description

timerScope

CountdownPlacement

The placement scope to fetch a timer for (e.g., 'product_page', 'cart_page')

Returns:

Promise<CountdownCampaign | null>

The active campaign, or null if none matches the scope, country, or time-window criteria

Exceptions

{Error} When the network request fails or times out

Example

Override to add custom query parameters:

window.boostWidgetIntegration.extend('CountdownTimerAPI', (CountdownTimerAPI) => {
  return class CustomCountdownTimerAPI extends CountdownTimerAPI {
    async getTimerForScope(timerScope) {
      const campaign = await super.getTimerForScope(timerScope);
      // Add shop-specific post-processing
      if (campaign) campaign.customLabel = this.getCustomLabel(timerScope);
      return campaign;
    }
  };
});