@@ -22,7 +22,7 @@ import {
2222 collectAttribution ,
2323 getOrCreateSession ,
2424 createConsentManager ,
25- canTrack as consentAllowsTracking ,
25+ canTrack ,
2626 startCmpDetection ,
2727} from '@imtbl/audience-core' ;
2828import { setupAutocapture } from './autocapture' ;
@@ -125,7 +125,7 @@ export class Pixel {
125125 if ( isAutoConsent ) {
126126 // CMP detection will fire the deferred page view when consent upgrades.
127127 this . startCmpDetection ( ) ;
128- } else if ( consentAllowsTracking ( this . consent . level ) ) {
128+ } else if ( canTrack ( this . consent . level ) ) {
129129 // Static consent — fire page view immediately.
130130 this . initialPageViewFired = true ;
131131 this . page ( ) ;
@@ -140,7 +140,7 @@ export class Pixel {
140140 }
141141
142142 page ( properties ?: Record < string , unknown > ) : void {
143- if ( ! this . canTrack ( ) ) return ;
143+ if ( ! this . isTrackingAllowed ( ) ) return ;
144144
145145 const { sessionId, isNew } = getOrCreateSession ( this . domain ) ;
146146 this . refreshSession ( sessionId , isNew ) ;
@@ -169,7 +169,7 @@ export class Pixel {
169169 // Fire the deferred page view if consent was upgraded from 'none'
170170 // (covers the case where CMP detection failed and the caller
171171 // manually sets consent as a fallback).
172- if ( consentAllowsTracking ( level ) && ! this . initialPageViewFired ) {
172+ if ( canTrack ( level ) && ! this . initialPageViewFired ) {
173173 this . initialPageViewFired = true ;
174174 this . page ( ) ;
175175 }
@@ -201,7 +201,7 @@ export class Pixel {
201201 this . consent ! . setLevel ( level ) ;
202202
203203 // Fire the deferred page view on first consent upgrade from 'none'.
204- if ( consentAllowsTracking ( level ) && ! this . initialPageViewFired ) {
204+ if ( canTrack ( level ) && ! this . initialPageViewFired ) {
205205 this . initialPageViewFired = true ;
206206 this . page ( ) ;
207207 }
@@ -211,7 +211,7 @@ export class Pixel {
211211 onCmpUpdate ,
212212 ( detector : CmpDetector ) => {
213213 // CMP found — apply the initial consent level it reported.
214- if ( consentAllowsTracking ( detector . level ) ) {
214+ if ( canTrack ( detector . level ) ) {
215215 onCmpUpdate ( detector . level ) ;
216216 }
217217 } ,
@@ -221,7 +221,7 @@ export class Pixel {
221221 // -- Auto-capture helper --------------------------------------------------
222222
223223 private track ( eventName : string , properties : Record < string , unknown > ) : void {
224- if ( ! this . canTrack ( ) ) return ;
224+ if ( ! this . isTrackingAllowed ( ) ) return ;
225225
226226 const { sessionId, isNew } = getOrCreateSession ( this . domain ) ;
227227 this . refreshSession ( sessionId , isNew ) ;
@@ -248,7 +248,7 @@ export class Pixel {
248248 }
249249
250250 private fireSessionStart ( sessionId : string ) : void {
251- if ( ! this . canTrack ( ) ) return ;
251+ if ( ! this . isTrackingAllowed ( ) ) return ;
252252
253253 const message : TrackMessage = {
254254 ...this . buildBase ( ) ,
@@ -262,7 +262,7 @@ export class Pixel {
262262 }
263263
264264 private fireSessionEnd ( ) : void {
265- if ( ! this . canTrack ( ) || ! this . sessionId ) return ;
265+ if ( ! this . isTrackingAllowed ( ) || ! this . sessionId ) return ;
266266
267267 const duration = this . sessionStartTime
268268 ? Math . round ( ( Date . now ( ) - this . sessionStartTime ) / 1000 )
@@ -338,8 +338,8 @@ export class Pixel {
338338
339339 // -- Guards -------------------------------------------------------------
340340
341- private canTrack ( ) : boolean {
342- return this . isReady ( ) && consentAllowsTracking ( this . consent ! . level ) ;
341+ private isTrackingAllowed ( ) : boolean {
342+ return this . isReady ( ) && canTrack ( this . consent ! . level ) ;
343343 }
344344
345345 private isReady ( ) : boolean {
0 commit comments