Repository navigation
A/B groups and feature flags.
- New
getABGroup(key),getABGroups()andonABGroups(callback)read the groups the capture service assigns to the visitor.getABGroupreturns the variant name of an A/B test ortrue/falsefor an on/off flag, and sends no event for a key the project does not serve.onABGroupsreports every group, including flags that are off, when they change and at once when they are already known. - Every event carries
$feature/<key>for each group once groups are known. - The
/flags/request carries one new field,$is_identified, so the capture service can keep an account in the same groups on every device. identify()asks for groups again when the current ID becomes identified without changing.- On
initthe SDK also asks for groups when the browser holds some from an earlier visit, even if the settings report none, so pausing a project's last test clears them. - The README covers A/B groups, including how a server can read the SDK's cookie to render the same groups. Groups are assignment, not access control.
Campaigns and tracking links.
- The landing page is recorded when
initruns, not at the first event. If the URL changes before the first event is sent, the events of the visit still carry the campaign parameters, the referrer and the$initial_*person properties of the page the visitor arrived on. When capturing is off atinit(opt_out_capturing_by_default,cookieless_mode: 'on_reject'), the same page is recorded once capturing starts, atopt_in_capturing()or atopt_out_capturing()inon_rejectmode.reset()discards it with the rest of the visitor's state, unless nothing was recorded for the visitor yet; the next visitor is recorded from the page they are on, without its campaign parameters if an event was already sent from that URL, as posthog-js reads the parameters of a URL once. - New
landingoption: pass{ url, referrer, at }recorded by your own code at page load, for apps that load the SDK after the page may have navigated.atis when you recorded it, in milliseconds since the epoch;urlandreferrerleft out are read from the document wheninitruns. A setting changed withset_configbefore the first event (save_campaign_params,save_referrer,mask_personal_data_properties,custom_personal_data_properties,custom_campaign_params) is applied to what was recorded, as ifinithad run with it; one turned off removes what was recorded for it, and while capturing is off nothing new is stored until it is back. $fbcis derived from thefbclidof the landing page when the URL at the first event no longer carries it. A_fbccookie from the Meta pixel takes precedence, as before, when it holds the same click or one recorded after the landing: afterlanding.at, or afterinitwhen the SDK read the URL itself. With alanding.urland noat, a cookie for another click takes precedence whatever its time.- Tedooo tracking-link parameters
tp_linkandtp_clickare captured as event properties by default, likeutm_*. Your owncustom_campaign_paramsare kept. Tedooo Panel credits a visit to a link from the page URL of the visit's first pageview or event, not from these properties: see "What a tracking link needs" in the README. $initial_ph_keywordis read from the stored initial referrer; posthog-js reads the keyword from the live referrer, which differs from the initial one on later page loads.- With the
segmentoption the landing page is still recorded at the first event, as in 0.1.0.
Based on posthog-js 1.435.6, as before.