The tracking script exposes a command queue via window._conv_q. You can push commands to this queue before or after the script loads — commands pushed before the script loads are processed once it initialises.
JavaScript
// Always initialise safely
window._conv_q = window._conv_q || [];
// Push a command
window._conv_q.push({
what: 'methodName',
params: { key: 'value' }
});
Important: Always use window._conv_q = window._conv_q || [] — never assign an empty array directly, as this overwrites any commands already in the queue.
Commands can use the modern object format or the legacy array format:
JavaScript
// Modern (recommended)
window._conv_q.push({ what: 'identify', params: { visitorId: 'abc123' } });
// Legacy
window._conv_q.push(['identify', { visitorId: 'abc123' }]);
Command Description Parameters identifySet a custom visitor ID (BYOID) { visitorId: string }
Command Description Parameters consentRequiredBlock tracking until consent is given { runExperiences?: boolean } (default: true)consentGivenSignal that consent has been given — flushes queued events and re-runs the script —
When runExperiences is false, both experiments and data collection are blocked until consent. When true (default), experiments display immediately but data collection waits.
Command Description Parameters runRe-run the full evaluation cycle — assignVariationProgrammatically decide a variation { experienceId, variationId }triggerExperienceVariationForce a specific variation (testing) { experienceId, variationId }executeExperienceManually run a specific experience { experienceId }disableExperienceDisable a specific experience { experienceId }enableExperienceRe-enable a disabled experience { experienceId }disableVariationDisable a specific variation { experienceId, variationId }enableVariationRe-enable a disabled variation { experienceId, variationId }doNotRunExperiencesDisable all experience processing — checkExperiencesRe-evaluate deferred experiences —
Command Description Parameters triggerConversionManually trigger a goal { goalId, experienceId? }triggerConversionsTrigger multiple goals Same as triggerConversion sendRevenueTrack a revenue transaction { goalId?, transactionId, amount, productsCount? }pushRevenueAlternative revenue tracking { amount, productsCount?, goalId?, transactionId? }recheckGoalsRe-evaluate all goals —
Command Description Parameters placeVisitorIntoSegmentManually place visitor into a segment { segmentId }checkSegmentsRe-evaluate segments that were waiting for data —
Command Description Parameters triggerLocationManually activate a location trigger { locationId }
Command Description Parameters setParametersSet tracking script parameters { delayContinuousActivation?, throttleChanges?, interceptEventsEarly? }setIntegrationVariableSet a custom variable for targeting { key, value }showBodyForce-remove the anti-flicker overlay —
Command Description Parameters refreshReload the current page (for split URL original) — redirectNavigate to a URL (for split URL variation) { url: string }
Command Description Parameters addListenerListen for lifecycle events { event, handler }readyCallback when the script has initialised function
You can listen for events fired during the tracking script's lifecycle:
JavaScript
window._conv_q = window._conv_q || [];
window._conv_q.push({
what: 'addListener',
params: {
event: 'experience.activated',
handler: function(data) {
console.log('Experience activated:', data.experienceId, data.variationId);
}
}
});
Event Description Data snippet.initializedScript started — snippet.segments_evaluatedSegments processed { visitorId }snippet.experiences_evaluatedExperiences processed — snippet.goals_evaluatedGoals processed — experience.activatedExperience shown to visitor { experienceId, variationId }experience.variation_decidedVariation selected { experienceId, variationId }goal.triggeredGoal conversion recorded { goalId }location.activatedLocation trigger matched { locationId }location.deactivatedLocation trigger unmatched { locationId }url.changedSPA navigation detected { from, to }render.completePage shown (anti-flicker removed) —
Timing: Listeners must be registered before the script processes them — either before the script loads, or from Global JavaScript. Listeners added after the script initialises will miss events that already fired.