javaamplitude-analytics

Amplitude + Java SDK : Unwanted properties like $price, $quantity and $revenue are set to ZERO while setting the user properties


In my project, I need to log the "user properties" of a specific user.

I am using following dependency:

compile group: 'com.amplitude', name: 'java-sdk', version: '1.2.3'

Here, is what my code looks like:

Amplitude client = Amplitude.getInstance();
client.init("PROJECT_API_KEY");

Event event = new Event("registerd_from_channel", "USER'S EMAILID");

JSONObject userProps = new JSONObject();
    try {
        userProps.put("is_user_registerd_from_channel", true);
    } catch (JSONException e) {
        error("Invalid JSON");
        e.printStackTrace();
    }

event.userProperties = userProps;
client.logEvent(event);

Problem: This code exactly worked as per the expectation but with this, some additional unwanted properties are also logged. like

$price -> 0
$quantity -> 0
$revenue -> 0

Question: How can I avoid such unwanted properties?

Sorry, I am a newbie in Amplitude and I have followed the following document: https://developers.amplitude.com/docs/java

It would be great if someone can suggest any blog/document for this.


Solution

  • I have asked the same question and got to know that they have already planned it.

    See here: github.com/amplitude/Amplitude-Java/issues/29

    I Will update the answer here... till the time I am closing the question.