From b7ee86363ace837b79ab363a3654e9f7c0bc48f7 Mon Sep 17 00:00:00 2001 From: Jason Axelson Date: Thu, 3 Apr 2025 15:09:52 -1000 Subject: [PATCH] Don't nest properties --- lib/posthog.ex | 16 ++++++---------- lib/posthog/client.ex | 5 +++-- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/lib/posthog.ex b/lib/posthog.ex index 8a23bef..677f49d 100644 --- a/lib/posthog.ex +++ b/lib/posthog.ex @@ -33,10 +33,8 @@ defmodule Posthog do # Event with properties Posthog.capture("purchase", [ distinct_id: "user_123", - properties: %{ - product_id: "prod_123", - price: 99.99 - } + product_id: "prod_123", + price: 99.99 ]) # Event with custom timestamp @@ -74,7 +72,7 @@ defmodule Posthog do events = [ {"page_view", [distinct_id: "user_123"], nil}, - {"button_click", [distinct_id: "user_123", properties: %{button: "signup"}], nil} + {"button_click", [distinct_id: "user_123", button: "signup"], nil} ] Posthog.batch(events) @@ -107,10 +105,8 @@ defmodule Posthog do # Event with properties Posthog.capture("purchase", [ distinct_id: "user_123", - properties: %{ - product_id: "prod_123", - price: 99.99 - } + product_id: "prod_123", + price: 99.99 ]) # Event with timestamp @@ -140,7 +136,7 @@ defmodule Posthog do events = [ {"page_view", [distinct_id: "user_123"], nil}, - {"button_click", [distinct_id: "user_123", properties: %{button: "signup"}], nil} + {"button_click", [distinct_id: "user_123", button: "signup"], nil} ] Posthog.batch(events) diff --git a/lib/posthog/client.ex b/lib/posthog/client.ex index da9c1aa..f4253f2 100644 --- a/lib/posthog/client.ex +++ b/lib/posthog/client.ex @@ -132,7 +132,8 @@ defmodule Posthog.Client do Posthog.Client.capture("purchase", %{ distinct_id: "user_123", - properties: %{product_id: "123", price: 99.99} + product_id: "123", + price: 99.99 }, timestamp: DateTime.utc_now() ) @@ -166,7 +167,7 @@ defmodule Posthog.Client do events = [ {"page_view", %{distinct_id: "user_123"}, nil}, - {"click", %{distinct_id: "user_123", properties: %{button: "signup"}}, DateTime.utc_now()} + {"click", %{distinct_id: "user_123", button: "signup"}, DateTime.utc_now()} ] Posthog.Client.batch(events)