Skip to content

Commit ea77f60

Browse files
author
Vignesh Raja
authored
Merge pull request #2 from optimizely/vignesh/change-revenue-to-eventValue
Change revenue to eventValue
2 parents 176c8f7 + 7b38703 commit ea77f60

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

core-api/src/main/java/com/optimizely/ab/Optimizely.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -180,21 +180,21 @@ public void track(@Nonnull String eventName,
180180

181181
public void track(@Nonnull String eventName,
182182
@Nonnull String userId,
183-
long revenue) throws UnknownEventTypeException {
184-
track(eventName, userId, Collections.<String, String>emptyMap(), revenue);
183+
long eventValue) throws UnknownEventTypeException {
184+
track(eventName, userId, Collections.<String, String>emptyMap(), eventValue);
185185
}
186186

187187
public void track(@Nonnull String eventName,
188188
@Nonnull String userId,
189189
@Nonnull Map<String, String> attributes,
190-
long revenue) throws UnknownEventTypeException {
191-
track(eventName, userId, attributes, (Long)revenue);
190+
long eventValue) throws UnknownEventTypeException {
191+
track(eventName, userId, attributes, (Long)eventValue);
192192
}
193193

194194
private void track(@Nonnull String eventName,
195195
@Nonnull String userId,
196196
@Nonnull Map<String, String> attributes,
197-
@CheckForNull Long revenue) throws UnknownEventTypeException {
197+
@CheckForNull Long eventValue) throws UnknownEventTypeException {
198198

199199
ProjectConfig currentConfig = getProjectConfig();
200200

@@ -212,14 +212,14 @@ private void track(@Nonnull String eventName,
212212
// create the conversion event request parameters, then dispatch
213213
String endpointUrl = eventBuilder.getEndpointUrl(currentConfig.getProjectId());
214214
Map<String, String> conversionParams;
215-
if (revenue == null) {
215+
if (eventValue == null) {
216216
conversionParams = eventBuilder.createConversionParams(currentConfig, bucketer, userId,
217217
eventType.getId(), eventType.getKey(),
218218
attributes);
219219
} else {
220220
conversionParams = eventBuilder.createConversionParams(currentConfig, bucketer, userId,
221221
eventType.getId(), eventType.getKey(), attributes,
222-
revenue);
222+
eventValue);
223223
}
224224

225225
if (conversionParams == null) {

core-api/src/main/java/com/optimizely/ab/event/internal/EventBuilder.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public class EventBuilder {
5454
private static final String GOAL_NAME_PARAM = "n";
5555
private static final String PPID_PARAM = "p";
5656
private static final String PROJECT_ID_PARAM = "a";
57-
private static final String REVENUE_PARAM = "v";
57+
private static final String EVENT_VALUE_PARAM = "v";
5858
private static final String SEGMENT_PARAM_PREFIX = "s";
5959
private static final String SOURCE_PARAM = "src";
6060
private static final String TIME_PARAM = "time";
@@ -89,8 +89,8 @@ public Map<String, String> createConversionParams(@Nonnull ProjectConfig project
8989
@Nonnull String eventId,
9090
@Nonnull String eventName,
9191
@Nonnull Map<String, String> attributes,
92-
long revenue) {
93-
return createConversionParams(projectConfig, bucketer, userId, eventId, eventName, attributes, (Long)revenue);
92+
long eventValue) {
93+
return createConversionParams(projectConfig, bucketer, userId, eventId, eventName, attributes, (Long)eventValue);
9494
}
9595

9696
private Map<String, String> createConversionParams(@Nonnull ProjectConfig projectConfig,
@@ -99,7 +99,7 @@ private Map<String, String> createConversionParams(@Nonnull ProjectConfig projec
9999
@Nonnull String eventId,
100100
@Nonnull String eventName,
101101
@Nonnull Map<String, String> attributes,
102-
@CheckForNull Long revenue) {
102+
@CheckForNull Long eventValue) {
103103

104104
Map<String, String> requestParams = new HashMap<String, String>();
105105
List<Experiment> addedExperiments =
@@ -110,7 +110,7 @@ private Map<String, String> createConversionParams(@Nonnull ProjectConfig projec
110110
}
111111

112112
addCommonRequestParams(requestParams, projectConfig, userId, attributes);
113-
addConversionGoal(requestParams, projectConfig, eventId, eventName, revenue);
113+
addConversionGoal(requestParams, projectConfig, eventId, eventName, eventValue);
114114

115115
return requestParams;
116116
}
@@ -256,15 +256,15 @@ private void addImpressionGoal(Map<String, String> requestParams, Experiment act
256256
* @param projectConfig the project config
257257
* @param eventId the goal being converted on
258258
* @param eventName the name of the custom event goal
259-
* @param revenue the optional revenue for the event
259+
* @param eventValue the optional event value for the event
260260
*/
261261
private void addConversionGoal(Map<String, String> requestParams, ProjectConfig projectConfig, String eventId,
262-
String eventName, @CheckForNull Long revenue) {
262+
String eventName, @CheckForNull Long eventValue) {
263263

264264
String eventIds = eventId;
265-
if (revenue != null) {
266-
requestParams.put(REVENUE_PARAM, revenue.toString());
267-
// to ensure that the revenue value is also included in "total revenue", pull in the default revenue goal
265+
if (eventValue != null) {
266+
// record the event value for the total revenue goal
267+
requestParams.put(EVENT_VALUE_PARAM, eventValue.toString());
268268
EventType revenueGoal = projectConfig.getEventNameMapping().get(EventType.TOTAL_REVENUE_GOAL_KEY);
269269
if (revenueGoal != null) {
270270
eventIds = eventId + "," + revenueGoal.getId();

0 commit comments

Comments
 (0)