diff --git a/amplitude/client.go b/amplitude/client.go index 136800f..c5d12f3 100644 --- a/amplitude/client.go +++ b/amplitude/client.go @@ -154,6 +154,7 @@ func (c *client) Revenue(revenue Revenue, eventOptions EventOptions) { constants.RevenueType: revenue.RevenueType, constants.RevenueReceipt: revenue.Receipt, constants.RevenueReceiptSig: revenue.ReceiptSig, + constants.Currency: revenue.Currency, constants.DefaultRevenue: revenue.Revenue, }, } diff --git a/amplitude/client_test.go b/amplitude/client_test.go index 8dde996..9cee473 100644 --- a/amplitude/client_test.go +++ b/amplitude/client_test.go @@ -159,6 +159,7 @@ func (t *ClientSuite) TestRevenue() { Quantity: 45, ProductID: "product-1", RevenueType: "revenue-1", + Currency: "USD", Receipt: "receipt-1", ReceiptSig: "sig-1", Revenue: 7, @@ -172,6 +173,7 @@ func (t *ClientSuite) TestRevenue() { "ip": "IP 1", "city": "IP 1 city", "event_properties": { + "$currency": "USD", "$price": 12.3, "$quantity": 45, "$productId": "product-1", diff --git a/amplitude/constants/constants.go b/amplitude/constants/constants.go index 2d5b03e..9553244 100644 --- a/amplitude/constants/constants.go +++ b/amplitude/constants/constants.go @@ -20,6 +20,7 @@ const ( RevenueQuantity = "$quantity" RevenuePrice = "$price" RevenueType = "$revenueType" + Currency = "$currency" RevenueReceipt = "$receipt" RevenueReceiptSig = "$receiptSig" DefaultRevenue = "$revenue" diff --git a/amplitude/types/event_options.go b/amplitude/types/event_options.go index 449d656..0bb7702 100644 --- a/amplitude/types/event_options.go +++ b/amplitude/types/event_options.go @@ -34,6 +34,7 @@ type EventOptions struct { Price float64 `json:"price,omitempty"` Quantity int `json:"quantity,omitempty"` Revenue float64 `json:"revenue,omitempty"` + Currency string `json:"currency,omitempty"` ProductID string `json:"productId,omitempty"` RevenueType string `json:"revenueType,omitempty"` EventID int `json:"event_id,omitempty"` diff --git a/amplitude/types/revenue.go b/amplitude/types/revenue.go index 07fe44a..5cb730e 100644 --- a/amplitude/types/revenue.go +++ b/amplitude/types/revenue.go @@ -5,6 +5,7 @@ type Revenue struct { Quantity int ProductID string RevenueType string + Currency string Receipt string ReceiptSig string Properties map[string]interface{}