@braze/web-sdk
Version:
Braze SDK for web sites and other JS platforms.
26 lines (25 loc) • 823 B
JavaScript
import { logger as N, EventTypes as d } from "../../shared-lib/index.js";
import c from "../common/event-logger.js";
import r from "../managers/braze-instance.js";
import tr from "./feature-flags-provider-factory.js";
export function logFeatureFlagImpression(e) {
if (!r.rr()) return;
if (!e) return !1;
const t =
"Not logging a feature flag impression. The feature flag was not part of any matching experiment.",
o = tr.m().Me();
if (!o[e]) return N.info(t), !1;
const n = o[e].trackingString;
if (!n) return N.info(t), !1;
const i = tr.m()._e();
if (i[n])
return (
N.info(
"Not logging another feature flag impression. This ID was already logged this session.",
),
!1
);
(i[n] = !0), tr.m().He(i);
const s = { fid: e, fts: n };
return c.ut(d.yr, s).tt;
}