Skip to content

Commit

Permalink
Track top of funnel
Browse files Browse the repository at this point in the history
  • Loading branch information
janbaykara committed Jan 30, 2024
1 parent acdbb1c commit 87da9fd
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions app/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1038,6 +1038,18 @@ def get(self, request: HttpRequest, *args: str, **kwargs: Any) -> HttpResponse:
user_id = request.session.session_key
enabled_variant = posthog.get_feature_flag(self.feature_flag, user_id)

# for 'top of funnel' event tracking
posthog.capture(
user_id,
"experiment begun",
{"feature_flag": self.feature_flag, "variant": enabled_variant},
)
posthog.capture(
user_id,
f"experiment {self.feature_flag} begun",
{"feature_flag": self.feature_flag, "variant": enabled_variant},
)

# self.variant_path_mapping
for variant in self.variant_path_mapping.keys():
if enabled_variant == variant:
Expand Down

0 comments on commit 87da9fd

Please sign in to comment.