2.22.2 — 2026-11-18
Patch changes
- e94faf5 Normalize event timestamp overrides from before_send to UTC without losing fractional precision, and send explicit defaults in feature flag requests. — Thanks @marandaneto!
2.22.1 — 2026-11-13
Patch changes
- e0b9bb6 Treat failed remote feature flag records as no result, omit their values and payloads, and report evaluation_failed on direct reads. — Thanks @marandaneto!
2.22.0 — 2026-11-13
Minor changes
- eef3c7f
PostHog.Emails.send/2takescc,bccandattachmentson a send withtemplate_key.ccandbccare one address or a list. Each attachment is a map withfilename,content(the file's raw bytes) and optionallycontent_typeandcontent_id. An email carries at most 10 files and 40 MB after Base64 encoding, about 29 MB of files. The SDK hashes each file, uploads the files PostHog doesn't have yet straight to PostHog's file storage, over https and without the secret key, and then sends the email with references to them. Plain-HTTP uploads are allowed only whenapp_hostis plain HTTP, as in local development. If an upload fails, it sends nothing and returnsattachment_upload_failed. An emptyreply_to,cc,bccorattachmentslist is now left out of the request. — Thanks @Silthus!
2.21.0 — 2026-11-12
Minor changes
- c16b737
PostHog.Emails.send/2takes:sensitiveand:trackingon a send withtemplate_key. Passsensitive: truewhen the email carries login links, reset tokens or codes: PostHog then keeps its links unchanged unless:trackingturns clicks on, leaves its subject off engagement events, and keeps its content out of logs. Left out, the email takes the setting of the template made in PostHog whose key matchestemplate_key, and is sensitive when no template matches.:trackingchooses what PostHog tracks for the email. Left out, PostHog counts opens and captures engagement events, and tracks clicks only when the email isn't sensitive.trueturns on opens, clicks and engagement events, andfalseturns them all off. A map such as%{clicks: true}sets:opens,:clicksand:engagementone by one.:capture_engagementis deprecated in favor oftracking: %{engagement: false}; it still works, but a send can't set both. The client now sends it only when you set it; PostHog already reads a missing value as on. The SDK sends:sensitiveand:trackingonly when you set them, and PostHog's API support for them is rolling out. — Thanks @Silthus!
2.20.1 — 2026-11-06
Patch changes
- 4206af6 Suppress local-evaluation definition warnings for client-only flags without changing local evaluation or unresolved reasons. — Thanks @marandaneto!
2.20.0 — 2026-11-05
Minor changes
85a2f1f The new
PostHog.Emailssends transactional email from your Elixir code and reads each email's delivery status.# config/runtime.exs config :posthog, api_key: "phc_...", secret_key: "phs_..." {:ok, %PostHog.Emails.SendResult{id: message_id}} = PostHog.Emails.send( to: "user@example.com", distinct_id: "user_123", template_key: "password-reset", subject: "Reset your password", html: rendered_html ) # "delivered", "bounced", ... {:ok, %PostHog.Emails.Status{status: status}} = PostHog.Emails.get(message_id)You can also send a template made in PostHog by its
template_id.You need a project secret API key, the kind that starts with
phs_. Create one under Project secret API keys in your project settings. Set its Transactional email scope to Write to send emails, or to Read for a key that only reads statuses. Set it assecret_keyin your:posthogconfig. Setapp_hostto your PostHog app URL when you self-host PostHog or send through a reverse proxy. The SDK also loads feature flags with this key, so give it Feature flags: Read too, or it logs a warning each time it polls.PostHog records each email's delivery, opens and clicks on the person with that
distinct_id. It groups every email with the sametemplate_key, so you see their metrics and logs in one place. The SDK retries a request that hits a network error, a rate limit or an outage twice by default. Every send carries an idempotency key, so a retry never sends the email twice. Pass your ownidempotency_key, such aswelcome:user_123, and your job runner's retries are safe too.A send with your own content also takes
from,reply_toandcapture_engagement: false. Setmigrated_fromin your config to tell PostHog which email provider you moved from. A failed call returns{:error, %PostHog.Emails.Error{}}with PostHog'scodeand the HTTPstatus_code.Docs: Send transactional emails with Elixir and the transactional email overview. — Thanks @Silthus for your first contribution 🎉!
2.19.0 — 2026-11-04
Minor changes
- fef3076 Report flags that local evaluation could not resolve on
PostHog.FeatureFlags.evaluate_flags/2snapshots. The newunresolved_flagsfield ofPostHog.FeatureFlags.Evaluationsmaps each such flag key to a reason::experience_continuity,:unsupported_definition,:unresolved_dependencyor:missing_context. When flag definitions load, log one warning for each flag that local evaluation can never resolve (experience continuity, a static cohort, an unknown operator, a malformed value, a regex that only the server can evaluate, or a missing or circular flag dependency), and log it again only when the definition of that flag changes.Behaviour changes (these apply to every flag function, includingcheck/3andget_feature_flag_result/4, not only toevaluate_flags/2):- A condition no longer stops at a filter that only the server can evaluate, such as a static cohort. If another filter in the condition does not match, the condition does not match, and a later condition can resolve the flag locally. Before, such a flag fell back to a remote request, or stayed unresolved with
only_evaluate_locally: true. - An unexpected error in a filter that follows a filter local evaluation can't check now makes only that condition inconclusive, and a later condition can still resolve the flag. Before, the flag fell back to a remote request, or stayed unresolved with
only_evaluate_locally: true. - A condition that depends on a flag that only the server can evaluate, such as a flag with a static cohort, now makes the flag fall back to a remote request, or stay unresolved with
only_evaluate_locally: true. Before, a later condition could resolve the flag locally to a different value than the server returns. A condition that depends on a flag with experience continuity enabled is still only inconclusive: a later condition can still resolve the flag, and only when none does, the flag falls back to a remote request, or stays unresolved withonly_evaluate_locally: true. $feature_flag_calledevents from snapshot reads reportlocal_evaluation_inconclusiveinstead offlag_missingfor flags inunresolved_flags. — Thanks @gustavohstrassburger for your first contribution 🎉!
- A condition no longer stops at a filter that only the server can evaluate, such as a static cohort. If another filter in the condition does not match, the condition does not match, and a later condition can resolve the flag locally. Before, such a flag fell back to a remote request, or stayed unresolved with
2.18.2 — 2026-10-30
Patch changes
- 747c160 Fix a process leak in feature flag snapshots. Snapshots no longer start a process to track accessed flags, so they need no cleanup and can be used from any process.Behaviour changes:
PostHog.FeatureFlags.Evaluations'saccessed_pidfield is deprecated and alwaysnil. Remove anyAgent.stop/1call on it.PostHog.FeatureFlags.Evaluations.accessed/1no longer returns keys that were read but are missing from the snapshot. — Thanks @marandaneto!
2.18.1 — 2026-10-29
Patch changes
- 8d9eb85 Stop the feature flag evaluations access-tracking Agent when the process that created the snapshot exits normally, instead of leaving it running for the life of the node. — Thanks @matthewlehner for your first contribution 🎉!
2.18.0 — 2026-10-23
Minor changes
- fdeb312 Add an optional OpenTelemetry processor that adds session and person IDs to new application spans from the active process context or PostHog header attributes already captured by application instrumentation. — Thanks @pauldambra!
2.17.0 — 2026-10-23
Minor changes
- 9705c66 Add the active OpenTelemetry trace and span IDs to exception events when the application provides OpenTelemetry. — Thanks @pauldambra for your first contribution 🎉!
2.16.4 — 2026-10-23
Patch changes
- 5c2e74f Fall back to remote feature flag evaluation for regex syntax and Unicode semantics that differ from the flags service, and preserve safe invalid-pattern handling. — Thanks @marandaneto!
2.16.3 — 2026-10-22
Patch changes
- 108b005 Allow shared flag definition cache providers to support local evaluation without a secret key. — Thanks @dustinbyrne!
2.16.2 — 2026-10-08
Patch changes
- b8c77e0 Fix
PostHog.Sendernot flushing all events on app termination. — Thanks @markovejnovic for your first contribution 🎉!
2.16.1 — 2026-10-07
Patch changes
- aea1877 Refactor regex schemas out of module attributes into private functions to fix Elixir 1.18
#Referencemacro compilation crash. — Thanks @boxxxie for your first contribution 🎉!
2.16.0 — 2026-09-25
Minor changes
- e4dbef7 Add
PostHog.OpenFeature.Provider, an OpenFeature provider for the Elixir OpenFeature SDK. Add{:open_feature, "~> 0.1"}to your dependencies to use it. — Thanks @seanpem for your first contribution 🎉!
Patch changes
- a401bd2 Stop leaking access tracker processes during OpenFeature flag evaluations. — Thanks @marandaneto!
2.15.1 — 2026-09-21
Patch changes
- a481ed7 Honor the definitions snapshot property_matching_version in local feature flag evaluation and shared definition caches. Missing or version 1 now intentionally matches released service legacy boolean truthiness rather than the former SDK behavior; version 2 uses explicit equality, with recursive truthiness for empty filters. Correct known-null complements and composite equality normalization. — Thanks @marandaneto!
2.15.0 — 2026-08-27
Minor changes
- c7c03fd Add local feature flag definition polling and evaluation with safe remote fallback. — Thanks @marandaneto!
2.14.2 — 2026-08-25
Patch changes
- 7e14b2a Return an empty feature flag snapshot without evaluation when feature flag keys are explicitly empty. — Thanks @marandaneto!
2.14.1 — 2026-08-12
Patch changes
- 35087c1 Keep gzip-compressed request bodies valid across retries — Thanks @marandaneto!
2.14.0 — 2026-07-31
Minor changes
- 4fed56b Send minimal
$feature_flag_calledevents when the/flagsresponse carries the server-controlledminimalFlagCalledEventsgate and the evaluated flag reportshas_experiment: false. Minimal events keep only an allowlisted set of properties (flag identity, evaluation metadata,$groups,$process_person_profile,$session_id,$lib,$lib_version,$is_server); everything else, including context and global properties, is stripped. Experiment-linked flags and responses without the gate keep the full event shape. — Thanks @haacked!
2.13.0 — 2026-07-23
Minor changes
- d66f174 Emit error tracking stack frames in canonical bottom-up order:
frames[0]is the outermost entry point and the last frame is the crash site. This aligns the Elixir SDK with the cross-SDK stack frame ordering standard. — Thanks @cat-ph!
2.12.1 — 2026-07-22
Patch changes
- dbe91ba Group captured log messages by logging call site instead of message content. Plain log messages often interpolate dynamic values (ids, URLs, inspected terms), and using the message as the exception type created a separate error tracking issue for every distinct message. The exception type is now
Logger <level> (<Module.function/arity>)when call-site metadata is available; the full message remains in the exception value. — Thanks @cat-ph!
2.12.0 — 2026-07-15
Minor changes
- 673ec2c Add a
$feature_flag_has_experimentboolean property to$feature_flag_calledevents, sourced from thehas_experimentfield in the/flagsresponse metadata. The property is only sent when the server explicitly reports the field; it is omitted when unknown (older deployments). — Thanks @haacked!
2.11.1 — 2026-07-08
Patch changes
- d1b8ed9 Require Req 0.6.1 or newer to avoid vulnerable 0.5.x and 0.6.0 releases. — Thanks @dustinbyrne!
2.11.0 — 2026-07-06
Minor changes
- a014220 Add before_send callback support for filtering captured events — Thanks @marandaneto!
2.10.3 — 2026-07-02
Patch changes
- 742e3d8 Add source location stacktrace frames for plain Logger messages. — Thanks @hpouillot!
2.10.2 — 2026-06-29
Patch changes
- 45cba19 Fall back to uncompressed API requests when gzip compression fails — Thanks @marandaneto!
2.10.1 — 2026-06-25
Patch changes
- 4d2af12 Dedupe feature flag called events by response — Thanks @marandaneto!
2.10.0 — 2026-06-16
Minor changes
- e086cb7 Add PostHog.LLMAnalytics.pop_span/1 function for convenient span context handoff between processes — Thanks @martosaur!
2.9.2 — 2026-06-12
Patch changes
- 4aa5504 relax Req and uuid-v7 version requirements — Thanks @martosaur!
2.9.1 — 2026-06-10
Patch changes
- 31b1d0f Send a
posthog-elixir/<version>User-Agent header on all API requests so PostHog recognizes the SDK as server-side and includes flags gated to the server runtime in/flagsresponses. — Thanks @haacked!
2.9.0 — 2026-06-03
Minor changes
- 8672156 Add a configurable
$is_serverevent property (defaulttrue) so PostHog can identify server-side events. Setis_server: falsewhen using posthog-elixir as a client/CLI so the device OS is attributed normally. — Thanks @turnipdabeets for your first contribution 🎉!
2.8.4 — 2026-06-01
Patch changes
- 5d18b01 Start in disabled/no-op mode instead of raising or sending events when the API key is missing, blank, or the supervisor is unavailable. — Thanks @marandaneto!
2.8.3 — 2026-05-28
Patch changes
- 98f1308 Improve error tracking grouping by always using arity to format stacktrace frames — Thanks @martosaur!
2.8.2 — 2026-05-18
Patch changes
- b737a36 Improve events batching logic and prevent SDK from sending empty batches — Thanks @martosaur!
2.8.1 — 2026-05-05
Patch changes
- 68baae7 Do not count
get_flag_payload/2calls as accesses foronly_accessed/1. — Thanks @dustinbyrne!
2.8.0 — 2026-05-01
Minor changes
65d520d Add
PostHog.FeatureFlags.evaluate_flags/2and thePostHog.FeatureFlags.Evaluationssnapshot so a single/flagscall can power both flag branching and event enrichment for one request:{:ok, snapshot} = PostHog.FeatureFlags.evaluate_flags("user-123") if PostHog.FeatureFlags.Evaluations.enabled?(snapshot, "new-dashboard") do render_new_dashboard() end PostHog.FeatureFlags.set_in_context(snapshot) PostHog.capture("page_viewed", %{distinct_id: "user-123"})The snapshot exposes
enabled?/2,get_flag/2,get_flag_payload/2,only/2,only_accessed/1,accessed/1,keys/1, andevent_properties/1. Passflag_keys: [...]toevaluate_flags/2to scope the underlying/flagsrequest itself. Whendistinct_idcannot be resolved,evaluate_flags/2returns an empty snapshot whose accessors are no-ops (matching the cross-SDK behavior).$feature_flag_calledevents fired fromcheck/3,check!/3,get_feature_flag_result/4, and the new snapshot path now attach$feature_flag_id,$feature_flag_version,$feature_flag_reason,$feature_flag_request_id,$feature_flag_payload,$feature/<key>, and$feature_flag_error(combiningerrors_while_computing_flagsand, on the snapshot path,flag_missing) when the response provides them. JSON-encoded payloads in/flagsresponses are now decoded before being attached to events and the:payloadfield on%PostHog.FeatureFlags.Result{}. The struct also gains:id,:version,:reason,:request_id,:evaluated_at, and:errors_while_computing.check/3,check!/3,get_feature_flag_result/4, andget_feature_flag_result!/4are now marked@deprecatedand emit compile-time warnings pointing atevaluate_flags/2. They continue to return the same values; removal is planned for the next major. — Thanks @dmarticus!
2.7.1 — 2026-04-30
Patch changes
- 48baad3 Default api_host when omitted — Thanks @marandaneto!
2.7.0 — 2026-04-29
Minor changes
- 43cbfcc Populate Plug request context from PostHog tracing headers. — Thanks @dustinbyrne!
2.6.1 — 2026-04-21
Patch changes
- f3fbed3 Trim surrounding whitespace from api_key and api_host config before validation and use — Thanks @marandaneto!
2.6.0 — 2026-03-25
Minor changes
- 8d21cc8 Add source code context to error tracking stack frames, and fix exception value formatting. — Thanks @cat-ph!
2.5.0 — 2026-03-02
Minor changes
- 12bcef3 Improve Error Tracking for complex errors. If an error has a
crash_reason, which is common for OTP reports, the SDK will report it as a chain of two exceptions. Additionally, some valuable information, such as process label, genserver state or last message, will be extracted from the report and put into event properties. — Thanks @martosaur!
2.4.0 — 2026-02-16
Minor changes
- 0f1f78e This is technically a breaking change because we're now always sending data gzip compressed and people might not want that, but this will not break anyone's code so we'll release it as a minor knowing that it's an improvement. It's always been possible to swap the client off, but we weren't documenting how to do that exactly - this is now solved too. — Thanks @rafaeelaudibert!
2.3.0 — 2026-02-12
Minor changes
- ba2f10a Implement proper retry behavior for requests. Also respects X-Retry-Later header. — Thanks @rafaeelaudibert!
- 39a304d We've now added a new
get_feature_flag_resultmethod that can be used to get a full view of your feature flags including the payload rather than simply a boolean/string from the enabled/variant state. — Thanks @rafaeelaudibert! - 1dc5271 Add support for Anthropic messages in the LLM analytis module — Thanks @rafaeelaudibert!
2.2.0 — 2026-02-05
Minor changes
4069a8e Add LLM Analytics
This release introduces a lightweight LLM analytics toolkit for instrumenting, recording, and analyzing large language model usage across applications that use this repository's SDK. It provides practical observability for teams running LLMs in production and during development. — Thanks @martosaur!
5fec2fd Add
uuidto events on every request to guarantee idempotency in the backend — Thanks @rafaeelaudibert!927c1b4 New release process via sampo — Thanks @rafaeelaudibert!
2.1.0 - 2025-11-25
- included evaluated_at properties in $feature_flag_called events
7c7ee1e978164809aa28162824f273f6f2bd33f2
2.0.0 - 2025-09-30
Major Release
posthog-elixir was fully reworked. Check migration guide
for some tips on how to upgrade.
Huge thanks to community member @martosaur for contributing this new version.
What's new
- Elixir v1.17+ required
- Event capture is now offloaded to background workers with automatic batching
- Context mechanism for easier property propagation
- Error Tracking support
- New
PostHog.FeatureFlagsmodule for working with feature flags - Test mode for easier testing
- Customizable HTTP client with Req as the default
- Plug integration for automatically capturing common HTTP properties
1.1.0 - 2025-07-01
- Expose
capture/2b077aba849126c63f1c7a82b6ad9d21945871a4a
1.0.3 - 2025-06-02
- Fix implementation for structs
2cdc6f578a192fd751ce105018a7f78b7ed8f852
1.0.2 - 2025-04-17
- More small changes to docs
147795c21a58e2308fbd43b571d9ba978c8a8a3b
1.0.1 - 2025-04-17
- Small changes to docs
f3578a7006fb8d6cb19f36e19b1387243a12bd21
1.0.0 - 2025-04-17
Big Release
posthog-elixir is now officially stable and running on v1. There are some breaking changes and some general improvements. Check MIGRATION.md for a guide on how to migrate.
What's changed
- Elixir v1.14+ is now a requirement
- Feature Flags now return a key called
payloadrather thanvalueto better align with the other SDKs - PostHog now requires you to initialize
Posthog.Applicationalongside your supervisor tree. This is required because of ourCachexsystem to properly track your FF usage.- We'll also include local evaluation in the near term, which will also require a GenServer, therefore, requiring us to use a Supervisor.
- Added
enabled_captureconfiguration option to disable PostHog tracking in development/test environments PostHog.capturenow requiresdistinct_idas a required second argument
0.4.4 - 2025-04-14
Fix inconsistent docs for properties - [#13]
0.4.3 - 2025-04-14
Improve docs setup - [#12]
0.4.2 - 2025-03-27
Allow atom() property keys - [#11]
0.4.1 - 2025-03-12
Fix feature flags broken implementation - [#10]
0.4.0 - 2025-02-11
Documentation + OTP/Elixir version bumps
0.3.0 - 2025-01-09
- Initial feature flags implementation (#7)
0.2.0 - 2024-05-04
- Allow extra headers (#3)
0.1.0 - 2020-06-06
- Initial release