Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do I set $revenue on revenue events with the SDK? #411

Open
GusRuss89 opened this issue Jul 9, 2021 · 3 comments
Open

How do I set $revenue on revenue events with the SDK? #411

GusRuss89 opened this issue Jul 9, 2021 · 3 comments
Labels
question Further information is requested

Comments

@GusRuss89
Copy link

Both the LTV Guide and the Tracking Revenue guide say that you must set $revenue on revenue events in order to track LTV.

The revenue interface in the JavaScript SDK doesn't provide a way to set that, and when I inspect the raw events from the Amplitude browser extension, I don't see any $revenue property either. The event properties look like this:

"event_properties": {
    "productId": "Credits",
    "value": 2.99,
    "hasCoupon": false,
    "$productId": "Credits",
    "$quantity": 1,
    "$price": 2.99
  },

So how can I set $revenue? Or are the docs incorrect in saying I need to set that property?

Thanks,
Angus

@GusRuss89 GusRuss89 added the question Further information is requested label Jul 9, 2021
@dantetam
Copy link
Contributor

Hello Angus @GusRuss89 ,

The help center has generic guides that do not rely on one individual language. Please take a look at the JavaScript guide for tracking revenue. Implementations in different languages vary wildly. Let us know if you have any more concerns about the Revenue API.

Dante

@GusRuss89
Copy link
Author

Hi @dantetam

Thanks for the response. I thought it might be the case that the JS SDK adds that property under the hood, but from what I can see in the raw event properties that get sent to Amplitude, there is no $revenue property.

So does the JS SDK do it correctly even though it doesn't add this property? Or is there no way to properly track LTV using the JS SDK? Or perhaps I'm supposed to set $revenue using Revenue.prototype.setEventProperties()?

Either way it seems that the two documentation pages I linked should be updated, because they both explicitly say that $revenue must be set on the event.

Thanks,
Angus

@dantetam
Copy link
Contributor

dantetam commented Jul 14, 2021

Hello Angus,

Yeah, you are right to notice there are discrepancies between API implementation across different languages, as well as discrepancies between the help center pages vs the developer docs. Regarding the documentation, they are meant to be two separate sets, for two different audiences. They are also maintained by two different teams. This repo and the engineering is monitored by us, the SDK engineering team. We'll try and align the documentation better.

Yes, to answer your question, the JS SDK should track LTV properly. From the documentation I sent:

The preferred method of tracking revenue for a user is to use logRevenueV2() in conjunction with the provided Revenue interface. Revenue instances will store each revenue transaction and allow you to define several special revenue properties (such as 'revenueType', 'productIdentifier', etc.) that are used in Amplitude's Event Segmentation and Revenue LTV charts.

I assume you are looking for this LTV chart analytics feature on the Amplitude website.

CC: @jooohhn @ajhorst

Dante

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants