com.medialets.android.analytics
Class MMEvent
java.lang.Object
com.medialets.android.analytics.MMEvent
public class MMEvent
extends java.lang.Object
Discussion
Complex events can be tracked by creating a MMEvent object instance. Create the instance, fill it with strings, numbers, and durations using the MMEvent methods, and then pass the event to the MMAnalyticsManager shared instance.
For example:
MMEvent myEvent = new MMEvent("AppStorePurchase"); myEvent.setStringForKey("Ammunition", "Product"); myEvent.setStringForKey("Ammo01", "SKU"); myEvent.setNumberForKey("Price", new Double(1.99)); Map dict = new Map(); dict.put("one", new Double(1.0)); dict.put("two", new Double(2.0)); dict.put("three", new Double(3.0)); myEvent.addNumbersFromMap(dict); myEvent.setDurationForKey("AppStoreResponseTime", new Double(1.50)); MMAnalyticsManager.sharedInstance().trackEvent(myEvent);
MMEvent(String key)
Returns a MMEvent object initialized with the specified event key.
| void | setStringForKey(String key, String value)
Adds a String to the event under the specified key. |
| void | addStringsFromMap(Map<String, String> map)
Adds a Map of String data to the event. |
| void | setNumberForKey(String key, Double value)
Adds a Double to the event under the specified key. |
| void | incrementNumberForKey(String key)
Increments a number set for a specific key. |
| void | addNumbersFromMap(Map<String, Double> map)
Adds a Map of Double data to the event. |
| void | setDurationForKey(String key, Double value)
Adds a Double to the event under the specified key. |
| void | addDurationsFromMap(Map<String, Double> map)
Adds a Map of Double data to the event. |
| void | startTimerForKey(String key)
Starts a timer with the specified key. |
| Double | endTimerForKey(String key)
Ends timing for the specified key and saves the duration to the event with the key. Returns the duration. |
MMEvent
public MMEvent(String key)
The constructor for MMEvent takes a key which is specified as the Event key.
Parameters:
key - The key that will be associated as the Event object's key.
Since:
2.0
setStringForKey
public void setStringForKey(String key, String value)
Adds a String to the event under the specified key.
Parameters:
key - The key associated with the value being saved.
value - The value being saved.
Since:
2.0
addStringsFromMap
public void addStringsFromMap(Map<String, String> map)
Adds a Map of String data to the event.
Parameters:
map - A collection of data in the form of a Map to add as Event data
Since:
2.0
setNumberForKey
public void setNumberForKey(String key, Double value)
Adds a Double to the event under the specified key.
Parameters:
key - The key to associate with the Event data value
value - The Double value being added to the Event data.
Since:
2.0
incrementNumberForKey
public void incrementNumberForKey(String key)
Increments a number set for a specific key.
Parameters:
key - The key associated with the numeric value to increment.
Since:
2.0
addNumbersFromMap
public void addNumbersFromMap(Map<String, Double> map)
Adds a Map of Double data to the event.
Parameters:
map - A collection of data in the form of a Map to add as Event data
Since:
2.0
setDurationForKey
public void setDurationForKey(String key, Double value)
Adds a Double to the event under the specified key.
Parameters:
key - The key associated with the duration
value - The Double value of the duration
Since:
2.0
addDurationsFromMap
public void addDurationsFromMap(Map<String, Double> map)
Adds a Map of Double data to the event.
Parameters:
map - The Map object containing durations
startTimerForKey
public void startTimerForKey(String key)
Starts a timer with the specified key.
Parameters:
key - The key associated with the timer
Since:
2.0
endTimerForKey
public Double endTimerForKey(String key)
Ends timing for the specified key and saves the duration to the event with the key. Returns the duration.
Parameters:
key - The key for the existing timer.
Return Value:
Returns the duration of the timer for the key. If no matching key is found, returns 0.
Discussion:
Has no effect unless startTimerForKey was first called with a
matching key.
Since:
2.0