Skip to content

Instantly share code, notes, and snippets.

@ovidijusr
Last active February 28, 2019 19:46
Show Gist options
  • Save ovidijusr/85cc6470fdbe52f41caec4c0c57b1beb to your computer and use it in GitHub Desktop.
Save ovidijusr/85cc6470fdbe52f41caec4c0c57b1beb to your computer and use it in GitHub Desktop.
// clicked on question on test menu
JSONObject eventProperties = new JSONObject();
try
{
eventProperties.put("question number", "10");
} catch (JSONException exception) {
}
Amplitude.getInstance().logEvent("clicked on question on test menu", eventProperties);
// is user online after click of complete test
JSONObject eventProperties = new JSONObject();
try
{
eventProperties.put("online", true); // or false
} catch (JSONException exception) {
}
Amplitude.getInstance().logEvent("is user online after click of complete test", eventProperties);
//finalized test
JSONObject eventProperties = new JSONObject();
try
{
eventProperties.put("percentage", 20); // 0-100
} catch (JSONException exception) {
}
Amplitude.getInstance().logEvent("is user online after click of complete test", eventProperties);
//clicked on a question cicrle
JSONObject eventProperties = new JSONObject();
try
{
eventProperties.put("questionNumber", 20); // 1-30
} catch (JSONException exception) {
}
Amplitude.getInstance().logEvent("clicked on a question cicrle ", eventProperties);
//searched in taisykles
JSONObject eventProperties = new JSONObject();
try
{
eventProperties.put("query", "kelio zenklai"); // any string
eventProperties.put("results", 20); // 0 - x
} catch (JSONException exception) {
}
Amplitude.getInstance().logEvent("searched in taisykles", eventProperties);
//toggle tab in taisyklės
JSONObject eventProperties = new JSONObject();
try
{
eventProperties.put("tabName", "kelio zenklai"); // any string
eventProperties.put("status", "opened"); // (or closed)
} catch (JSONException exception) {
}
Amplitude.getInstance().logEvent("toggle tab in taisyklės", eventProperties);
//completed test
JSONArray passedTests = new JSONArray();
JSONArray failedTests = new JSONArray();
//foreach (question)
if (question.passed) {
passedTests.put(question.id)
} else {
failedTests.put(question.id)
}
JSONObject eventProperties = new JSONObject();
eventProperties.put("passedTests", passedTests);
eventProperties.put("failedTests", failedTests);
Amplitude.getInstance().logEvent("Completed tests", eventProperties);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment