@OnClick(R.id.trackGoalButton) void onTrackGoalClicked(View view) { float revenue; try { revenue = Integer.valueOf( ((EditText) findViewById(R.id.goalTextEditView)).getText().toString() ); } catch (Exception e) { TrackHelper.track().exception(e).description("wrong revenue").with(getTracker()); revenue = 0; } TrackHelper.track().goal(1).revenue(revenue).with(getTracker()); }
@Override public TrackMe build() { if (mIdGoal < 0) { throw new IllegalArgumentException("Goal id needs to be >=0"); } TrackMe trackMe = new TrackMe(getBaseTrackMe()).set(QueryParams.GOAL_ID, mIdGoal); if (mRevenue != null) trackMe.set(QueryParams.REVENUE, mRevenue); return trackMe; } }
/** * By default, Goals in Matomo are defined as "matching" parts of the screen path or screen title. * In this case a conversion is logged automatically. In some situations, you may want to trigger * a conversion manually on other types of actions, for example: * when a user submits a form * when a user has stayed more than a given amount of time on the page * when a user does some interaction in your Android application * * @param idGoal id of goal as defined in matomo goal settings */ public Goal goal(int idGoal) { return new Goal(this, idGoal); }
/** * By default, Goals in Matomo are defined as "matching" parts of the screen path or screen title. * In this case a conversion is logged automatically. In some situations, you may want to trigger * a conversion manually on other types of actions, for example: * when a user submits a form * when a user has stayed more than a given amount of time on the page * when a user does some interaction in your Android application * * @param idGoal id of goal as defined in matomo goal settings */ public Goal goal(int idGoal) { return new Goal(this, idGoal); }
@Test public void testTrackGoal() throws Exception { track().goal(1).with(mTracker); verify(mTracker).track(mCaptor.capture()); assertNull(mCaptor.getValue().get(QueryParams.REVENUE)); assertEquals(mCaptor.getValue().get(QueryParams.GOAL_ID), "1"); }
@OnClick(R.id.trackGoalButton) void onTrackGoalClicked(View view) { float revenue; try { revenue = Integer.valueOf( ((EditText) findViewById(R.id.goalTextEditView)).getText().toString() ); } catch (Exception e) { TrackHelper.track().exception(e).description("wrong revenue").with(getTracker()); revenue = 0; } TrackHelper.track().goal(1).revenue(revenue).with(getTracker()); }
@Test public void testTrackGoal() throws Exception { track().goal(1).with(mTracker); verify(mTracker).track(mCaptor.capture()); assertNull(mCaptor.getValue().get(QueryParams.REVENUE)); assertEquals(mCaptor.getValue().get(QueryParams.GOAL_ID), "1"); }
@Override public TrackMe build() { if (mIdGoal < 0) { throw new IllegalArgumentException("Goal id needs to be >=0"); } TrackMe trackMe = new TrackMe(getBaseTrackMe()).set(QueryParams.GOAL_ID, mIdGoal); if (mRevenue != null) trackMe.set(QueryParams.REVENUE, mRevenue); return trackMe; } }