Skip to content

Commit 0e80db5

Browse files
Vignesh RajaJosh Deffibaugh
authored andcommitted
Change revenue to eventValue
1 parent 74e910a commit 0e80db5

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
@@ -186,21 +186,21 @@ public void track(@Nonnull String eventName,
186186

187187
public void track(@Nonnull String eventName,
188188
@Nonnull String userId,
189-
long revenue) throws UnknownEventTypeException {
190-
track(eventName, userId, Collections.<String, String>emptyMap(), revenue);
189+
long eventValue) throws UnknownEventTypeException {
190+
track(eventName, userId, Collections.<String, String>emptyMap(), eventValue);
191191
}
192192

193193
public void track(@Nonnull String eventName,
194194
@Nonnull String userId,
195195
@Nonnull Map<String, String> attributes,
196-
long revenue) throws UnknownEventTypeException {
197-
track(eventName, userId, attributes, (Long)revenue);
196+
long eventValue) throws UnknownEventTypeException {
197+
track(eventName, userId, attributes, (Long)eventValue);
198198
}
199199

200200
private void track(@Nonnull String eventName,
201201
@Nonnull String userId,
202202
@Nonnull Map<String, String> attributes,
203-
@CheckForNull Long revenue) throws UnknownEventTypeException {
203+
@CheckForNull Long eventValue) throws UnknownEventTypeException {
204204

205205
ProjectConfig currentConfig = getProjectConfig();
206206

@@ -218,14 +218,14 @@ private void track(@Nonnull String eventName,
218218
// create the conversion event request parameters, then dispatch
219219
String endpointUrl = eventBuilder.getEndpointUrl(currentConfig.getProjectId());
220220
Map<String, String> conversionParams;
221-
if (revenue == null) {
221+
if (eventValue == null) {
222222
conversionParams = eventBuilder.createConversionParams(currentConfig, bucketer, userId,
223223
eventType.getId(), eventType.getKey(),
224224
attributes);
225225
} else {
226226
conversionParams = eventBuilder.createConversionParams(currentConfig, bucketer, userId,
227227
eventType.getId(), eventType.getKey(), attributes,
228-
revenue);
228+
eventValue);
229229
}
230230

231231
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)