getFrequencyCapState
Return the current state of every valid frequency cap configured with setFrequencyCaps.
Example
Section titled “Example”const state = window.htag.api('1').getFrequencyCapState();
console.log(state['interstitial']);// { impressionTimestampsMs: [1785499200000], blocked: true, nextImpressionAllowedAtMs: 1785499500000 }Return Value
Section titled “Return Value”An object keyed by cap ID:
- impressionTimestampsMs: Impression timestamps in milliseconds that still count after pruning.
- blocked: Whether the cap has reached its limit and prevents another impression.
- nextImpressionAllowedAtMs: Earliest timestamp in milliseconds at which the next impression is allowed. Omitted for an unblocked cap and for a lifetime maximum that never expires.
blocked reflects the recorded impressions only, so it answers “has this cap reached its limit right now”.
Related Methods
Section titled “Related Methods”- setFrequencyCaps: Configure placement or label-targeted frequency caps
- clearFrequencyCapHistory: Clear selected or all cap histories