You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Feature Flags now return a key called `payload` rather than `value` to better align with the other SDKs
27
-
- PostHog now requires you to initialize `PostHog.Application` alongside your supervisor tree. This is required because of our `Cachex` system to properly track your FF usage.
47
+
- PostHog now requires you to initialize `Posthog.Application` alongside your supervisor tree. This is required because of our `Cachex` system to properly track your FF usage.
28
48
- We'll also include local evaluation in the near term, which will also require a GenServer, therefore, requiring us to use a Supervisor.
29
49
- Added `enabled_capture` configuration option to disable PostHog tracking in development/test environments
30
50
-`PostHog.capture` now requires `distinct_id` as a required second argument
Copy file name to clipboardExpand all lines: MIGRATION.md
+36-5Lines changed: 36 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,11 +4,42 @@ This is a migration guide for all major version bumps
4
4
5
5
## v1 -> v2
6
6
7
-
TODO: New library
7
+
Version 2.0 is a whole new library, so we encourage you to use this upgrade as
8
+
an opportunity to revisit your PostHog usage in your application. Even the root
9
+
level module was renamed from `Posthog` to `PostHog`.
10
+
11
+
### Configuration
12
+
13
+
Configuration has been completely reworked. We advise you to remove your
14
+
existing configuration and follow [Getting Started](README.md#getting-started)
15
+
section for setup.
16
+
17
+
### Event Capture
18
+
19
+
`PostHog.capture` signature has changed. It now accepts properties only as a
20
+
map. `distinct_id` is now included in the properties.
21
+
22
+
```elixir
23
+
PostHog.capture("user_signed_up", %{
24
+
distinct_id:"distinct_id_of_the_user",
25
+
login_type:"email",
26
+
is_free_trial:true
27
+
})
28
+
```
29
+
30
+
No additional options can be passed. PostHog now automatically offloads events to a
31
+
pool of sender workers that will batch and send your events. This also means
32
+
that `Posthog.batch` doesn't exist anymore and you should simply call `capture/2` for each of your events.
33
+
34
+
### Feature Flags
35
+
36
+
`Posthog.feature_flag` and `Posthog.feature_flag_enabled` functions were
37
+
replaced with `PostHog.FeatureFlags` module. Check its docs for the new usage
38
+
guidelines.
8
39
9
40
## v0 -> v1
10
41
11
-
When we stabilized our library, we decided to pull some breaking changes, here are they and how you can migrate:
42
+
When we stabilized our library, we decided to pull some breaking changes.
12
43
13
44
### Minimum Elixir version bumped to v1.14
14
45
@@ -19,9 +50,9 @@ The library previously supported Elixir v1.12+. You'll need to migrate to Elixir
19
50
20
51
### Decide v4 - Feature Flags
21
52
22
-
PostHog is consistently upgrading our internal data representation so that's better for customers each and every time. We've recently launched a new version of our `/decide` endpoint called `v4`. This endpoint is slightly different, which caused a small change in behavior for our flags.
53
+
PostHog is consistently upgrading our internal data representation so that it's better for users each and every time. We've recently launched a new version of our `/decide` endpoint called `v4`. This endpoint is slightly different, which caused a small change in behavior for our flags.
23
54
24
-
`PostHog.FeatureFlag` previously included a key `value`that to represent the internal structure of a flag. It was renamed to `payload` to:
55
+
`PostHog.FeatureFlag` previously included a key `value` to represent the internal structure of a flag. It was renamed to `payload` to:
25
56
26
57
1. better represent the fact that it can be both an object and a boolean
27
58
2. align it more closely with our other SDKs
@@ -43,7 +74,7 @@ def application do
43
74
end
44
75
```
45
76
46
-
2. Or, if you're already using an Application, you can add add `PostHog.Application` to your own supervision tree:
77
+
2. Or, if you're already using an Application, you can add `Posthog.Application` to your own supervision tree:
0 commit comments