测量 App 内事件
Measuring in-app events to understand how your audience interacts with your mobile app directly impacts your ability to build effective and profitable advertising campaigns.
By analyzing the interactions that users have with your app, you can:
-
Enable Re-Targetings
Logging app events creates an easier way to reach your existing audience for other campaigns (re-target your current audience for new and relevant campaigns), and also specific subsets of users based on their actions within your app.
-
Understand Your App’s Audience
You can log custom app events for any actions that a user makes in your app (for example, making payments or achieving a level in a game) and then view demographic information for each group of users who performed these actions.
-
Analyze and Optimize Retention and LTV (Lifetime Value)
You can use app events to better understand the engagement and return-on-investment (ROI) derived from your mobile campaigns. If you’re logging app events, then MAT shows them as different types of events in reporting so you can see which campaigns drove what actions within your app.
To log the events that occur within your app, configure the SDK to log the in-app events that interest you. Below is a complete list of all of the pre-defined events (grouped by category) that TUNE supports natively, along with the attributes to collect for each event. Some attributes are required while others are optional, but we highly recommend collecting these optional attributes whenever possible (the granularity and knowledge gained from analyzing your reports is dependent on how much you log–the more you log, the greater and deeper the insight gained from the collected data).
Things to keep in mind:
- By default, TUNE rejects all duplicate requests for the same event made by the same user/device within a one-hour window.
- For the Attribution Analytics solution only, there is a maximum event limit per mobile app of 100 events.
- Only the "Reservation" and "Purchase" events measure revenue. If you want to measure revenue for other events, you need to enable Revenue Aggregation.
In-App Events
Achievement Unlocked
The achievement unlocked event occurs when a user gets access to a new achievement (for example, finds a secret key in a gaming app). This event also shows the user engagement and can identify the skill level of the user in the game. You can also use the EventAttribute1
parameter with this event to store the name of unlocked achievement.
- User ID (recommended)
- Facebook User ID (recommended if authentication with Facebook)
- Twitter User ID (recommended if authentication with Twitter)
- Google User ID (recommended if authentication with Google)
- Name/ID of Achievement set with EventContentId or EventAttribute 1 (required)
Android SDK Achievement Unlocked Event
ITune tune = Tune.getInstance();
tune.setFacebookUserId("facebookUserId");
tune.setGoogleUserId("googleUserId");
tune.setTwitterUserId("twitterUserId");
tune.measureEvent(new TuneEvent(TuneEvent.ACHIEVEMENT_UNLOCKED).withContentId("winning streak"));
iOS SDK Achievement Unlocked Event
[Tune setUserId:@"US13579"];
[Tune setFacebookUserId:@"321321321321"];
[Tune setGoogleUserId:@"11223344556677"];
[Tune setTwitterUserId:@"1357924680"];
TuneEvent *event = [TuneEvent eventWithName:TUNE_EVENT_ACHIEVEMENT_UNLOCKED];
event.contentId = @"achievementId123";
[Tune measureEvent:event];
Javascript SDK Achievement Unlocked Event
MobileAppTracker.setUserId("userId");
MobileAppTracker.setFacebookUserId("facebookUserId");
MobileAppTracker.setGoogleUserId("googleUserId");
MobileAppTracker.setTwitterUserId("twitterUserId");
MobileAppTracker.setEventContentId("winning streak");
MobileAppTracker.measureAction({"eventName": "achievement_unlocked"});
Windows SDK Achievement Unlocked Event
mobileAppTracker.SetUserId("userId");
mobileAppTracker.SetFacebookUserId("facebookUserId");
mobileAppTracker.SetGoogleUserId("googleUserId");
mobileAppTracker.SetTwitterUserId("twitterUserId");
mobileAppTracker.SetEventContentId("winning_streak");
mobileAppTracker.MeasureAction("achievement_unlocked");
Adobe Air Plugin Achievement Unlocked Event
Tune.instance.setFacebookUserId("facebookUserId");
Tune.instance.setGoogleUserId("googleUserId");
Tune.instance.setTwitterUserId("twitterUserId");
var tuneEvent:Dictionary = new Dictionary();
tuneEvent.name = "achievement_unlocked";
tuneEvent.contentId = "winning streak";
Tune.instance.measureEvent(tuneEvent);
Cocos2dx Plugin Achievement Unlocked Event
sdkbox::PluginTune::setUserId("userId");
sdkbox::PluginTune::setFacebookUserId("facebookUserId");
sdkbox::PluginTune::setGoogleUserId("googleUserId");
sdkbox::PluginTune::setTwitterUserId("twitterUserId");
TuneEvent event;
event.eventName = "achievement_unlocked";
event.contentId = "winning streak";
sdkbox::PluginTune::measureEvent(event);
PhoneGap Plugin Achievement Unlocked Event
window.plugins.tunePlugin.setFacebookUserId("facebookUserId");
window.plugins.tunePlugin.setGoogleUserId("googleUserId");
window.plugins.tunePlugin.setTwitterUserId("twitterUserId");
var tuneEvent = {
"name": "achievement_unlocked",
"contentId": "winning streak"
};
window.plugins.tunePlugin.measureEvent(tuneEvent);
Unity Plugin Achievement Unlocked Event
using TuneSDK;
Tune.SetFacebookUserId("facebookUserId");
Tune.SetGoogleUserId("googleUserId");
Tune.SetTwitterUserId("twitterUserId");
TuneEvent tuneEvent = new TuneEvent("achievement_unlocked");
tuneEvent.contentId = "winning streak";
Tune.MeasureEvent(tuneEvent);
Xamarin Plugin Achivement Unlocked Event
Android
Tune.Instance.SetFacebookUserId("facebookUserId");
Tune.Instance.SetGoogleUserId("googleUserId");
Tune.Instance.SetTwitterUserId("twitterUserId");
TuneEvent event = new TuneEvent(TuneEvent.AchievementUnlocked).WithContentId("winning streak"));
Tune.Instance.MeasureEvent(event);
iOS
using TuneSDK;
Tune.SetFacebookUserId("facebookId");
Tune.SetGoogleUserId("googleId");
Tune.SetTwitterUserId("twitterId");
TuneEvent evt = TuneEvent.EventWithName ("achievement_unlocked");
evt.ContentId = achievementId;
Tune.MeasureEvent (evt);
添加到购物车
When a user adds a product (item) to their cart, log this event with the specific product added as one event item.
- User ID (recommended)
- Facebook User ID (recommended if authentication with Facebook)
- Twitter User ID (recommended if authentication with Twitter)
- Google User ID (recommended if authentication with Google)
- Latitude (optional)
- Longitude (optional)
- Altitude (optional)
- Items Added to Cart Array of event items added to cart (required)
- Event item should include:
- Name – name of the item
- Product ID – SKU
- Unit Price – individual price of one unit
- Quantity – number of items purchased
- Revenue – total value of the purchase
- Event item should include:
- Revenue (recommended; passed into measureAction)
- Currency Code (recommended if Revenue set; passed into measureAction)
注意
In-App Marketing does not support events or event item data for Add to Cart.
Android SDK Add to Cart Event
ITune tune = Tune.getInstance();
tune.setUserId("userId");
tune.setFacebookUserId("facebookUserId");
tune.setGoogleUserId("googleUserId");
tune.setTwitterUserId("twitterUserId");
tune.setAge(35);
tune.setGender(TuneGender.MALE);
tune.setLocation(location);
tune.measureEvent(new TuneEvent(TuneEvent.ADD_TO_CART)
.withEventItems(eventItems)
.withRevenue(4.99)
.withCurrencyCode("USD"));
iOS SDK Add to Cart Event
TuneEventItem *item1 = [TuneEventItem eventItemWithName:@"ball1" unitPrice:3.99 quantity:2];
TuneEventItem *item2 = [TuneEventItem eventItemWithName:@"ball2" unitPrice:9.99 quantity:1 revenue:9.99 attribute1:@"red" attribute2:@"inflatable" attribute3:@"rubber" attribute4:nil attribute5:nil];
NSArray *eventItems = @[item1, item2];
[Tune setUserId:@"US13579"];
[Tune setFacebookUserId:@"321321321321"];
[Tune setGoogleUserId:@"11223344556677"];
[Tune setTwitterUserId:@"1357924680"];
[Tune setAge:43];
[Tune setGender:TuneGenderFemale];
TuneLocation *loc = [TuneLocation new];
loc.latitude = @(9.142276);
loc.longitude = @(-79.724052);
loc.altitude = @(15.);
[Tune setLocation:loc];
TuneEvent *event = [TuneEvent eventWithName:TUNE_EVENT_ADD_TO_CART];
event.eventItems = eventItems;
event.revenue = 17.99;
event.currencyCode = @"USD";
[Tune measureEvent:event];
Javascript SDK Add to Cart Event
MobileAppTracker.setUserId("userId");
MobileAppTracker.setFacebookUserId("facebookUserId");
MobileAppTracker.setGoogleUserId("googleUserId");
MobileAppTracker.setTwitterUserId("twitterUserId");
MobileAppTracker.setLatitude(47.61);
MobileAppTracker.setLongitude(-122.33);
MobileAppTracker.setAltitude(55);
MobileAppTracker.measureAction({"eventName": "add_to_cart",
"revenue": 4.99,
"currencyCode": "USD",
"eventItems": eventItems});
Windows SDK Add to Cart Event
mobileAppTracker.SetUserId("userId");
mobileAppTracker.SetFacebookUserId("facebookUserId");
mobileAppTracker.SetGoogleUserId("googleUserId");
mobileAppTracker.SetTwitterUserId("twitterUserId");
mobileAppTracker.SetLatitude(47.61);
mobileAppTracker.SetLongitude(-122.33);
mobileAppTracker.SetAltitude(55);
mobileAppTracker.MeasureAction("add_to_cart", 4.99, "USD", null, eventItems);
Adobe Air Plugin Add to Cart Event
Tune.instance.setUserId("userId");
Tune.instance.setFacebookUserId("facebookUserId");
Tune.instance.setGoogleUserId("googleUserId");
Tune.instance.setTwitterUserId("twitterUserId");
Tune.instance.setAge(35);
Tune.instance.setGender(0); // 0 is male, 1 female
Tune.instance.setLocation(47.61, -122.33, 55);
var tuneEvent:Dictionary = new Dictionary();
tuneEvent.name = "add_to_cart";
tuneEvent.revenue = 4.99;
tuneEvent.currency = "USD";
tuneEvent.eventItems = eventItems;
Tune.instance.measureEvent(tuneEvent);
Cocos2dx Plugin Add to Cart Event
sdkbox::PluginTune::setUserEmail("userEmail");
sdkbox::PluginTune::setUserId("userId");
sdkbox::PluginTune::setUserName("username");
sdkbox::PluginTune::setAge(35);
sdkbox::PluginTune::setGender(sdkbox::PluginTune::GenderMale);
sdkbox::PluginTune::setFacebookUserId("facebookUserId");
sdkbox::PluginTune::setGoogleUserId("googleUserId");
sdkbox::PluginTune::setTwitterUserId("twitterUserId");
sdkbox::PluginTune::setLatitude(47.61f, -122.33f, 55f);
TuneEvent event;
event.eventName = "add_to_cart";
event.revenue = 4.99;
event.currencyCode = "USD";
event.refId = "12999748531";
event.eventItems = eventItems;
sdkbox::PluginTune::measureEvent(event);
PhoneGap Plugin Add to Cart Event
window.plugins.tunePlugin.setUserId("userId");
window.plugins.tunePlugin.setFacebookUserId("facebookUserId");
window.plugins.tunePlugin.setGoogleUserId("googleUserId");
window.plugins.tunePlugin.setTwitterUserId("twitterUserId");
window.plugins.tunePlugin.setAge(35);
window.plugins.tunePlugin.setGender(0); // 0 is male, 1 female
window.plugins.tunePlugin.setLocationWithAltitude(47.61, -122.33, 55);
var tuneEvent = {
"name": "add_to_cart",
"eventItems": eventItems,
"revenue": 4.99,
"currency": "USD"
};
window.plugins.tunePlugin.measureEvent(tuneEvent);
Unity Plugin Add to Cart Event
using TuneSDK;
Tune.SetUserId("userId");
Tune.SetFacebookUserId("facebookUserId");
Tune.SetGoogleUserId("googleUserId");
Tune.SetTwitterUserId("twitterUserId");
Tune.SetAge(35);
Tune.SetGender(0); // 0 is male, 1 female
Tune.SetLocation(47.61, -122.33, 55);
TuneEvent tuneEvent = new TuneEvent("add_to_cart");
tuneEvent.eventItems = eventItems;
Tune.MeasureEvent(tuneEvent);
Xamarin Plugin Add to Cart Event
Android
using TuneSDK;
Tune.Instance.SetUserId("userId");
Tune.Instance.SetFacebookUserId("facebookUserId");
Tune.Instance.SetGoogleUserId("googleUserId");
Tune.Instance.SetTwitterUserId("twitterUserId");
Tune.Instance.SetAge(35);
Tune.Instance.SetGender(MATGender.MALE);
Tune.Instance.SetLocation(location);
Tune.Instance.MeasureEvent(new TuneEvent(TuneEvent.AddToCart)
.WithEventItems(eventItems)
.WithRevenue(4.99)
.WithCurrencyCode("USD"));
iOS
using TuneSDK;
Tune.SetUserId ("userId");
Tune.SetFacebookUserId ("facebookId");
Tune.SetGoogleUserId ("googleId");
Tune.SetTwitterUserId ("twitterId");
Tune.SetAge (age);
Tune.SetGender (gender); // 0 for male, 1 for female, 2 for other
TuneLocation sampleLocation = new TuneLocation ();
sampleLocation.SetLatitude (latitude);
sampleLocation.SetLongitude (longitude);
sampleLocation.SetAltitude (altitude);
Tune.SetLocation (sampleLocation);
TuneEvent evt = TuneEvent.EventWithName ("add_to_cart");
evt.Revenue = 132.6f;
evt.CurrencyCode = "USD";
Tune.MeasureEvent (evt);
Add to Wishlist
Similar to the Add to Cart event, but instead of the user intending to buy the product now, they’re saving the product to a list to buy in the future.
- User ID (recommended)
- Facebook User ID (recommended if authentication with Facebook)
- Twitter User ID (recommended if authentication with Twitter)
- Google User ID (recommended if authentication with Google)
- Latitude (optional)
- Longitude (optional)
- Altitude (optional)
- Currency Code (optional)
- Add to Wishlist Event Array of event items added to wishlist (required)
- Event item should include:
- Name – name of the item
- Product ID – SKU
- Unit Price – individual price of one unit
- Event item should include:
注意
In-App Marketing does not support events or event item data for Add to Wishlist.
Android SDK Add to Wishlist Event
ITune tune = Tune.getInstance();
tune.setUserId("userId");
tune.setFacebookUserId("facebookUserId");
tune.setGoogleUserId("googleUserId");
tune.setTwitterUserId("twitterUserId");
tune.setLocation(location);
tune.setCurrencyCode("USD");
tune.measureEvent(new TuneEvent(TuneEvent.ADD_TO_WISHLIST).withEventItems(eventItems));
iOS SDK Add to Wishlist Event
TuneEventItem *item1 = [TuneEventItem eventItemWithName:@"ball1" unitPrice:3.99 quantity:2];
TuneEventItem *item2 = [TuneEventItem eventItemWithName:@"ball2" unitPrice:9.99 quantity:1 revenue:9.99 attribute1:@"red" attribute2:@"inflatable" attribute3:@"rubber" attribute4:nil attribute5:nil];
NSArray *eventItems = @[item1, item2];
[Tune setUserId:@"US13579"];
[Tune setFacebookUserId:@"321321321321"];
[Tune setGoogleUserId:@"11223344556677"];
[Tune setTwitterUserId:@"1357924680"];
TuneLocation *loc = [TuneLocation new];
loc.latitude = @(9.142276);
loc.longitude = @(-79.724052);
loc.altitude = @(15.);
[Tune setLocation:loc];
TuneEvent *event = [TuneEvent eventWithName:TUNE_EVENT_ADD_TO_WISHLIST];
event.eventItems = eventItems;
event.currencyCode = @"USD";
[Tune measureEvent:event];
Javascript SDK Add to Wishlist Event
MobileAppTracker.setUserId("userId");
MobileAppTracker.setFacebookUserId("facebookUserId");
MobileAppTracker.setGoogleUserId("googleUserId");
MobileAppTracker.setTwitterUserId("twitterUserId");
MobileAppTracker.setLatitude(47.61);
MobileAppTracker.setLongitude(-122.33);
MobileAppTracker.setAltitude(55);
MobileAppTracker.setCurrencyCode("USD");
MobileAppTracker.measureAction({"eventName": "add_to_wishlist",
"eventItems": eventItems});
Windows SDK Add to Wishlist Event
mobileAppTracker.SetUserId("userId");
mobileAppTracker.SetFacebookUserId("facebookUserId");
mobileAppTracker.SetGoogleUserId("googleUserId");
mobileAppTracker.SetTwitterUserId("twitterUserId");
mobileAppTracker.SetLatitude(47.61);
mobileAppTracker.SetLongitude(-122.33);
mobileAppTracker.SetAltitude(55);
mobileAppTracker.MeasureAction("add_to_wishlist", 0, "USD", null, eventItems);
Adobe Air Plugin Add to Wishlist Event
Tune.instance.setUserId("userId");
Tune.instance.setFacebookUserId("facebookUserId");
Tune.instance.setGoogleUserId("googleUserId");
Tune.instance.setTwitterUserId("twitterUserId");
Tune.instance.setLocation(latitude, longitude, altitude);
var tuneEvent:Dictionary = new Dictionary();
tuneEvent.name = "add_to_wishlist";
tuneEvent.currency = "USD";
tuneEvent.eventItems = eventItems;
Tune.instance.measureEvent(tuneEvent);
Cocos2dx Plugin Add to Wishlist Event
sdkbox::PluginTune::setUserId("userId");
sdkbox::PluginTune::setFacebookUserId("facebookUserId");
sdkbox::PluginTune::setGoogleUserId("googleUserId");
sdkbox::PluginTune::setTwitterUserId("twitterUserId");
sdkbox::PluginTune::setLatitude(47.61f, -122.33f, 55f);
TuneEvent event;
event.eventName = "add_to_wishlist";
event.currencyCode = "USD";
event.eventItems = eventItems;
sdkbox::PluginTune::measureEvent(event);
PhoneGap Plugin Add to Wishlist Event
window.plugins.tunePlugin.setUserId("userId");
window.plugins.tunePlugin.setFacebookUserId("facebookUserId");
window.plugins.tunePlugin.setGoogleUserId("googleUserId");
window.plugins.tunePlugin.setTwitterUserId("twitterUserId");
window.plugins.tunePlugin.setLocationWithAltitude(47.61, -122.33, 55);
var tuneEvent = {
"name": "add_to_wishlist",
"eventItems": eventItems,
"currency": "USD"
};
window.plugins.tunePlugin.measureEvent(tuneEvent);
Unity Plugin Add to Wishlist Event
using TuneSDK;
Tune.SetUserId("userId");
Tune.SetFacebookUserId("facebookUserId");
Tune.SetGoogleUserId("googleUserId");
Tune.SetTwitterUserId("twitterUserId");
Tune.SetLocation(47.61, -122.33, 55);
TuneEvent tuneEvent = new TuneEvent("add_to_wishlist");
tuneEvent.eventItems = eventItems;
Tune.MeasureEvent(tuneEvent);
Xamarin Plugin Add to Wishlist Event
Android
using TuneSDK;
Tune.Instance.SetUserId("userId");
Tune.Instance.SetFacebookUserId("facebookUserId");
Tune.Instance.SetGoogleUserId("googleUserId");
Tune.Instance.SetTwitterUserId("twitterUserId");
Tune.Instance.SetLocation(location);
Tune.Instance.SetCurrencyCode("USD");
Tune.Instance.MeasureEvent(new TuneEvent(TuneEvent.AddToWishlist).WithEventItems(eventItems));
iOS
using TuneSDK;
Tune.SetUserId ("userId");
Tune.SetFacebookUserId ("facebookId");
Tune.SetGoogleUserId ("googleId");
Tune.SetTwitterUserId ("twitterId");
Tune.SetAge (age);
Tune.SetGender (gender); // 0 for male, 1 for female, 2 for other
TuneLocation sampleLocation = new TuneLocation ();
sampleLocation.SetLatitude (latitude);
sampleLocation.SetLongitude (longitude);
sampleLocation.SetAltitude (altitude);
Tune.SetLocation (sampleLocation);
TuneEvent evt = TuneEvent.EventWithName ("add_to_wishlist");
evt.CurrencyCode = "USD";
TuneEventItem item1 = TuneEventItem.EventItemWithName("item1", 0.99f, 1, 0.99f, "1", "2", "3", "4", "5");
TuneEventItem item2 = TuneEventItem.EventItemWithName("item2", 0.50f, 2, 1.0f);
evt.EventItems = new TuneEventItem[] { item1, item2 };
Tune.MeasureEvent(evt);
Added Payment Info
Include the following values when logging the payment info added event:
- User ID (recommended)
- Facebook User ID (recommended if authentication with Facebook)
- Twitter User ID (recommended if authentication with Twitter)
- Google User ID (recommended if authentication with Google)
Android SDK Added Payment Info Event
ITune tune = Tune.getInstance();
tune.setUserId("userId");
tune.setFacebookUserId("facebookUserId");
tune.setGoogleUserId("googleUserId");
tune.setTwitterUserId("twitterUserId");
tune.measureEvent(TuneEvent.ADDED_PAYMENT_INFO);
iOS SDK Added Payment Info Event
[Tune setUserId:@"US13579"];
[Tune setFacebookUserId:@"321321321321"];
[Tune setGoogleUserId:@"11223344556677"];
[Tune setTwitterUserId:@"1357924680"];
[Tune measureEventName:TUNE_EVENT_ADDED_PAYMENT_INFO];
Javascript SDK Added Payment Info Event
MobileAppTracker.setUserEmail("userEmail");
MobileAppTracker.setUserId("userId");
MobileAppTracker.setFacebookUserId("facebookUserId");
MobileAppTracker.setGoogleUserId("googleUserId");
MobileAppTracker.setTwitterUserId("twitterUserId");
MobileAppTracker.measureAction({"eventName": "added_payment_info"});
Windows SDK Added Payment Info Event
mobileAppTracker.SetUserId("userId");
mobileAppTracker.SetFacebookUserId("facebookUserId");
mobileAppTracker.SetGoogleUserId("googleUserId");
mobileAppTracker.SetTwitterUserId("twitterUserId");
mobileAppTracker.MeasureAction("added_payment_info");
Adobe Air Plugin Added Payment Info Event
Tune.instance.setUserId("userId");
Tune.instance.setFacebookUserId("facebookUserId");
Tune.instance.setGoogleUserId("googleUserId");
Tune.instance.setTwitterUserId("twitterUserId");
Tune.instance.measureEventName("added_payment_info");
Cocos2dx Plugin Added Payment Info Event
sdkbox::PluginTune::setUserId("userId");
sdkbox::PluginTune::setFacebookUserId("facebookUserId");
sdkbox::PluginTune::setGoogleUserId("googleUserId");
sdkbox::PluginTune::setTwitterUserId("twitterUserId");
sdkbox::PluginTune::measureEventName("added_payment_info");
PhoneGap Plugin Added Payment Info Event
window.plugins.tunePlugin.setUserId("userId");
window.plugins.tunePlugin.setFacebookUserId("facebookUserId");
window.plugins.tunePlugin.setGoogleUserId("googleUserId");
window.plugins.tunePlugin.setTwitterUserId("twitterUserId");
window.plugins.tunePlugin.measureEvent("added_payment_info");
Unity Plugin Added Payment Info Event
using TuneSDK;
Tune.SetUserId("userId");
Tune.SetFacebookUserId("facebookUserId");
Tune.SetGoogleUserId("googleUserId");
Tune.SetTwitterUserId("twitterUserId");
Tune.MeasureEvent("added_payment_info");
Xamarin Plugin Added Payment Info Event
Android
Tune.Instance.SetUserId("userId");
Tune.Instance.SetFacebookUserId("facebookUserId");
Tune.Instance.SetGoogleUserId("googleUserId");
Tune.Instance.SetTwitterUserId("twitterUserId");
Tune.Instance.MeasureEvent(TuneEvent.AddedPaymentInfo);
iOS
using TuneSDK;
Tune.SetUserId ("userId");
Tune.SetFacebookUserId ("facebookId");
Tune.SetGoogleUserId ("googleId");
Tune.SetTwitterUserId ("twitterId");
Tune.MeasureEventName ("added_payment_info");
Checkout Initiated
Similar to the purchase event, but TUNE logs this event immediately after the desired items (products) are defined and the user initiates the checkout process.
You can use this "checkout initiated" event to determine which products a client did not complete purchasing (the items that they abandoned). You can use this abandoned product data to re-market to the user and encourage them to complete their purchase.
- User ID (recommended)
- Facebook User ID (recommended if authentication with Facebook)
- Twitter User ID (recommended if authentication with Twitter)
- Google User ID (recommended if authentication with Google)
- Latitude (optional)
- Longitude (optional)
- Altitude (optional)
- Event Items Array of event items that were added to the cart (required)
- Event item should include:
- Name – name of the item
- Product ID – SKU
- Unit Price – individual price of one unit
- Quantity – number of items purchased
- Revenue – total value of the purchase
- Event item should include:
- Order or Receipt ID (required; passed as referenceID into measureEvent)
- Revenue (recommended; passed into measureEvent)
- Currency Code (recommended if Revenue set; passed into measureEvent)
注意
In-App Marketing does not support events or event item data for Checkout Initiated.
Android SDK Checkout Initiated Event
ITune tune = Tune.getInstance();
tune.setUserId("userId");
tune.setFacebookUserId("facebookUserId");
tune.setGoogleUserId("googleUserId");
tune.setTwitterUserId("twitterUserId");
tune.setLocation(location);
tune.measureEvent(new TuneEvent(TuneEvent.CHECKOUT_INITIATED)
.withEventItems(eventItems)
.withRevenue(17.41)
.withCurrencyCode("USD")
.withAdvertiserRefId("12999748531"));
iOS SDK Checkout Initiated Event
TuneEventItem *item1 = [TuneEventItem eventItemWithName:@"ball1" unitPrice:3.99 quantity:2];
TuneEventItem *item2 = [TuneEventItem eventItemWithName:@"ball2" unitPrice:9.99 quantity:1 revenue:9.99 attribute1:@"red" attribute2:@"inflatable" attribute3:@"rubber" attribute4:nil attribute5:nil];
NSArray *eventItems = @[item1, item2];
[Tune setUserId:@"US13579"];
[Tune setFacebookUserId:@"321321321321"];
[Tune setGoogleUserId:@"11223344556677"];
[Tune setTwitterUserId:@"1357924680"];
TuneLocation *loc = [TuneLocation new];
loc.latitude = @(9.142276);
loc.longitude = @(-79.724052);
loc.altitude = @(15.);
[Tune setLocation:loc];
TuneEvent *event = [TuneEvent eventWithName:TUNE_EVENT_CHECKOUT_INITIATED];
event.eventItems = eventItems;
event.refId = @"ref13571";
event.revenue = 17.97;
event.currencyCode = @"USD";
[Tune measureEvent:event];
Javascript SDK Checkout Initiated Event
MobileAppTracker.setUserId("userId");
MobileAppTracker.setFacebookUserId("facebookUserId");
MobileAppTracker.setGoogleUserId("googleUserId");
MobileAppTracker.setTwitterUserId("twitterUserId");
MobileAppTracker.setLatitude(47.61);
MobileAppTracker.setLongitude(-122.33);
MobileAppTracker.setAltitude(55);
MobileAppTracker.measureAction({"eventName": "checkout_initiated",
"revenue": 17.41,
"currencyCode": "USD",
"referenceId": "12999748531",
"eventItems": eventItems});
Windows SDK Checkout Initiated Event
mobileAppTracker.SetUserId("userId");
mobileAppTracker.SetFacebookUserId("facebookUserId");
mobileAppTracker.SetGoogleUserId("googleUserId");
mobileAppTracker.SetTwitterUserId("twitterUserId");
mobileAppTracker.SetLatitude(47.61);
mobileAppTracker.SetLongitude(-122.33);
mobileAppTracker.SetAltitude(55);
mobileAppTracker.MeasureAction("checkout_initiated", 17.41, "USD", "12999748531", eventItems);
Adobe Air Plugin Checkout Initiated Event
Tune.instance.setUserId("userId");
Tune.instance.setFacebookUserId("facebookUserId");
Tune.instance.setGoogleUserId("googleUserId");
Tune.instance.setTwitterUserId("twitterUserId");
Tune.instance.setLocation(47.61, -122.33, 55);
var tuneEvent:Dictionary = new Dictionary();
tuneEvent.name = "checkout_initiated";
tuneEvent.revenue = 17.41;
tuneEvent.currency = "USD";
tuneEvent.refId = "12999748531";
tuneEvent.eventItems = eventItems;
Tune.instance.measureEvent(tuneEvent);
Cocos2dx Plugin Checkout Initiated Event
sdkbox::PluginTune::setUserId("userId");
sdkbox::PluginTune::setFacebookUserId("facebookUserId");
sdkbox::PluginTune::setGoogleUserId("googleUserId");
sdkbox::PluginTune::setTwitterUserId("twitterUserId");
sdkbox::PluginTune::setLatitude(47.61f, -122.33f, 55f);
TuneEvent event;
event.eventName = "checkout_initiated";
event.revenue = 17.41;
event.currencyCode = "USD";
event.refId = "12999748531";
event.eventItems = eventItems;
sdkbox::PluginTune::measureEvent(event);
PhoneGap Plugin Checkout Initiated Event
window.plugins.tunePlugin.setUserId("userId");
window.plugins.tunePlugin.setFacebookUserId("facebookUserId");
window.plugins.tunePlugin.setGoogleUserId("googleUserId");
window.plugins.tunePlugin.setTwitterUserId("twitterUserId");
window.plugins.tunePlugin.setLocationWithAltitude(47.61, -122.33, 55);
var tuneEvent = {
"name": "checkout_initiated",
"eventItems": eventItems,
"revenue": 17.41,
"currency": "USD",
"advertiserRefId": "12999748531"
};
window.plugins.tunePlugin.measureEvent(tuneEvent);
Unity Plugin Checkout Initiated Event
using TuneSDK;
Tune.SetUserId("userId");
Tune.SetFacebookUserId("facebookUserId");
Tune.SetGoogleUserId("googleUserId");
Tune.SetTwitterUserId("twitterUserId");
Tune.SetLocation(47.61, -122.33, 55);
TuneEvent tuneEvent = new TuneEvent("checkout_initiated");
tuneEvent.eventItems = eventItems;
tuneEvent.advertiserRefId = "12999748531";
tuneEvent.revenue = 17.41;
tuneEvent.currencyCode = "USD";
Tune.MeasureEvent(tuneEvent);
Xamarin Plugin Checkout Initiated Event
Android
using TuneSDK;
Tune.Instance.SetUserId("userId");
Tune.Instance.SetFacebookUserId("facebookUserId");
Tune.Instance.SetGoogleUserId("googleUserId");
Tune.Instance.SetTwitterUserId("twitterUserId");
Tune.Instance.SetLocation(location);
Tune.Instance.MeasureEvent(new TuneEvent(TuneEvent.CheckoutInitiated)
.WithEventItems(eventItems)
.WithRevenue(17.41)
.WithCurrencyCode("USD")
.WithAdvertiserRefId("12999748531"));
iOS
using TuneSDK;
Tune.SetUserId ("userId");
Tune.SetFacebookUserId ("facebookId");
Tune.SetGoogleUserId ("googleId");
Tune.SetTwitterUserId ("twitterId");
TuneLocation sampleLocation = new TuneLocation ();
sampleLocation.SetLatitude (latitude);
sampleLocation.SetLongitude (longitude);
sampleLocation.SetAltitude (altitude);
Tune.SetLocation (sampleLocation);
TuneEvent evt = TuneEvent.EventWithName ("checkout_initiated");
evt.RefId = "abc";
evt.Revenue = 1.99f;
evt.CurrencyCode = "USD";
TuneEventItem item1 = TuneEventItem.EventItemWithName("item1", 0.99f, 1, 0.99f, "1", "2", "3", "4", "5");
TuneEventItem item2 = TuneEventItem.EventItemWithName("item2", 0.50f, 2, 1.0f);
evt.EventItems = new TuneEventItem[] { item1, item2 };
Tune.MeasureEvent(evt);
Content View
The "content view" event occurs when a user views a specific piece of content or product. If it is a product and not just content, then set the event items payload with one item.
- User ID (recommended)
- Facebook User ID (recommended if authentication with Facebook)
- Twitter User ID (recommended if authentication with Twitter)
- Google User ID (recommended if authentication with Google)
- Latitude (optional)
- Longitude (optional)
- Altitude (optional)
- Currency Code (optional)
- Content Viewed Array of a single event item that is being viewed (required, if product)
- Event item (SKU) for a purchase should include:
- Name – name of the item
- Product ID – SKU
- Unit Price – individual price of one unit
- Quantity – number of items purchased
- Revenue – total value of the purchase
- Event item (SKU) for a purchase should include:
注意
In-App Marketing does not support events or event item data for Content View.
Android SDK Content View Event
ITune tune = Tune.getInstance();
tune.setUserId("userId");
tune.setFacebookUserId("facebookUserId");
tune.setGoogleUserId("googleUserId");
tune.setTwitterUserId("twitterUserId");
tune.setLocation(location);
tune.setCurrencyCode("USD");
tune.measureEvent(new TuneEvent(TuneEvent.CONTENT_VIEW).withEventItems(eventItem));
iOS SDK Content View Event
TuneEventItem *item1 = [TuneEventItem eventItemWithName:@"ball1" unitPrice:3.99 quantity:2];
TuneEventItem *item2 = [TuneEventItem eventItemWithName:@"ball2" unitPrice:9.99 quantity:1 revenue:9.99 attribute1:@"red" attribute2:@"inflatable" attribute3:@"rubber" attribute4:nil attribute5:nil];
NSArray *eventItems = @[item1, item2];
[Tune setUserId:@"US13579"];
[Tune setFacebookUserId:@"321321321321"];
[Tune setGoogleUserId:@"11223344556677"];
[Tune setTwitterUserId:@"1357924680"];
TuneLocation *loc = [TuneLocation new];
loc.latitude = @(9.142276);
loc.longitude = @(-79.724052);
loc.altitude = @(15.);
[Tune setLocation:loc];
TuneEvent *event = [TuneEvent eventWithName:TUNE_EVENT_CONTENT_VIEW];
event.currencyCode = @"USD";
event.eventItems = eventItems;
[Tune measureEvent:event];
Javascript SDK Content View Event
MobileAppTracker.setUserId("userId");
MobileAppTracker.setFacebookUserId("facebookUserId");
MobileAppTracker.setGoogleUserId("googleUserId");
MobileAppTracker.setTwitterUserId("twitterUserId");
MobileAppTracker.setLatitude(47.61);
MobileAppTracker.setLongitude(-122.33);
MobileAppTracker.setAltitude(55);
MobileAppTracker.setCurrencyCode("USD");
MobileAppTracker.measureAction({"eventName": "content_view",
"eventItems": eventItems});
Windows SDK Content View Event
mobileAppTracker.SetUserId("userId");
mobileAppTracker.SetFacebookUserId("facebookUserId");
mobileAppTracker.SetGoogleUserId("googleUserId");
mobileAppTracker.SetTwitterUserId("twitterUserId");
mobileAppTracker.SetLatitude(47.61);
mobileAppTracker.SetLongitude(-122.33);
mobileAppTracker.SetAltitude(55);
mobileAppTracker.MeasureAction("content_view", 0, "USD", null, eventItems);
Adobe Air Plugin Content View Event
Tune.instance.setUserId("userId");
Tune.instance.setFacebookUserId("facebookUserId");
Tune.instance.setGoogleUserId("googleUserId");
Tune.instance.setTwitterUserId("twitterUserId");
Tune.instance.setLocation(47.61, -122.33, 55);
var tuneEvent:Dictionary = new Dictionary();
tuneEvent.name = "content_view";
tuneEvent.currency = "USD";
tuneEvent.eventItems = eventItems;
Tune.instance.measureEvent(tuneEvent);
Cocos2dx Plugin Content View Event
sdkbox::PluginTune::setUserId("userId");
sdkbox::PluginTune::setFacebookUserId("facebookUserId");
sdkbox::PluginTune::setGoogleUserId("googleUserId");
sdkbox::PluginTune::setTwitterUserId("twitterUserId");
sdkbox::PluginTune::setLatitude(47.61f, -122.33f, 55f);
TuneEvent event;
event.eventName = "content_view";
event.currencyCode = "USD";
event.eventItems = eventItems;
sdkbox::PluginTune::measureEvent(event);
PhoneGap Plugin Content View Event
window.plugins.tunePlugin.setUserId("userId");
window.plugins.tunePlugin.setFacebookUserId("facebookUserId");
window.plugins.tunePlugin.setGoogleUserId("googleUserId");
window.plugins.tunePlugin.setTwitterUserId("twitterUserId");
window.plugins.tunePlugin.setLocationWithAltitude(47.61, -122.33, 55);
var tuneEvent = {
"name": "content_view",
"eventItems": eventItems,
"currency": "USD"
};
window.plugins.tunePlugin.measureEvent(tuneEvent);
Unity Plugin Content View Event
using TuneSDK;
Tune.SetUserId("userId");
Tune.SetFacebookUserId("facebookUserId");
Tune.SetGoogleUserId("googleUserId");
Tune.SetTwitterUserId("twitterUserId");
Tune.SetLocation(47.61, -122.33, 55);
TuneEvent tuneEvent = new TuneEvent("content_view");
tuneEvent.eventItems = eventItems;
Tune.MeasureEvent(tuneEvent);
Xamarin Plugin Content View Event
Android
using TuneSDK;
Tune.Instance.UserId = userId;
Tune.Instance.FacebookUserId = facebookUserId;
Tune.Instance.GoogleUserId = googleUserId;
Tune.Instance.TwitterUserId = twitterUserId;
Tune.Instance.SetLocation(new TuneLocation(latitude, longitude));
Tune.Instance.CurrencyCode = "USD";
TuneEventItem item1 = new TuneEventItem("ball1").WithUnitPrice(3.99f).WithQuantity(2).WithRevenue(3.99f);
TuneEventItem item2 = new TuneEventItem("ball2").WithUnitPrice(9.99f).WithQuantity(1).WithRevenue(9.99f).WithAttribute1("red").WithAttribute2("inflatable").WithAttribute3("rubber");
List < TuneEventItem > eventItems = new List< TuneEventItem > () { item1, item2 };
TuneEvent tuneEvent = new TuneEvent(TuneEvent.ContentView).WithEventItems(eventItems);
Tune.Instance.MeasureEvent(tuneEvent);
iOS
using TuneSDK;
Tune.SetUserId ("userId");
Tune.SetFacebookUserId ("facebookId");
Tune.SetGoogleUserId ("googleId");
Tune.SetTwitterUserId ("twitterId");
TuneLocation sampleLocation = new TuneLocation ();
sampleLocation.SetLatitude (latitude);
sampleLocation.SetLongitude (longitude);
sampleLocation.SetAltitude (altitude);
Tune.SetLocation (sampleLocation);
TuneEvent evt = TuneEvent.EventWithName ("content_view");
evt.RefId = "abc";
evt.Revenue = 1.99f;
evt.CurrencyCode = "USD";
TuneEventItem item1 = TuneEventItem.EventItemWithName("item1", 0.99f, 1, 0.99f, "red", "inflatable", "rubber", "", "");
TuneEventItem item2 = TuneEventItem.EventItemWithName("item2", 0.50f, 2, 1.0f);
evt.EventItems = new TuneEventItem[] { item1, item2 };
Tune.MeasureEvent(evt);
邀请
The Invite event occurs when a user invites their friends to join your service and/or install your mobile app. Log this invite after the user completes the invite process (which may invite their friends to join via SMS, email, or another form of communication).
- User ID (recommended)
- Facebook User ID (recommended if authentication with Facebook)
- Twitter User ID (recommended if authentication with Twitter)
- Google User ID (recommended if authentication with Google)
Android SDK Invite Event
ITune tune = Tune.getInstance();
tune.setUserId("userId");
tune.setFacebookUserId("facebookUserId");
tune.setGoogleUserId("googleUserId");
tune.setTwitterUserId("twitterUserId");
tune.measureEvent(TuneEvent.INVITE);
iOS SDK Invite Event
[Tune setUserId:@"US13579"];
[Tune setFacebookUserId:@"321321321321"];
[Tune setGoogleUserId:@"11223344556677"];
[Tune setTwitterUserId:@"1357924680"];
[Tune measureEventName:TUNE_EVENT_INVITE];
Javascript SDK Invite Event
MobileAppTracker.setUserId("userId");
MobileAppTracker.setFacebookUserId("facebookUserId");
MobileAppTracker.setGoogleUserId("googleUserId");
MobileAppTracker.setTwitterUserId("twitterUserId");
MobileAppTracker.measureAction({"eventName": "invite"});
Windows SDK Invite Event
mobileAppTracker.SetUserId("userId");
mobileAppTracker.SetFacebookUserId("facebookUserId");
mobileAppTracker.SetGoogleUserId("googleUserId");
mobileAppTracker.SetTwitterUserId("twitterUserId");
mobileAppTracker.MeasureAction("invite");
Adobe Air Plugin Invite Event
Tune.instance.setUserId("userId");
Tune.instance.setFacebookUserId("facebookUserId");
Tune.instance.setGoogleUserId("googleUserId");
Tune.instance.setTwitterUserId("twitterUserId");
Tune.instance.measureEventName("invite");
Cocos2dx Plugin Invite Event
sdkbox::PluginTune::setUserId("userId");
sdkbox::PluginTune::setFacebookUserId("facebookUserId");
sdkbox::PluginTune::setGoogleUserId("googleUserId");
sdkbox::PluginTune::setTwitterUserId("twitterUserId");
sdkbox::PluginTune::measureEventName("invite");
PhoneGap Plugin Invite Event
window.plugins.tunePlugin.setUserId("userId");
window.plugins.tunePlugin.setFacebookUserId("facebookUserId");
window.plugins.tunePlugin.setGoogleUserId("googleUserId");
window.plugins.tunePlugin.setTwitterUserId("twitterUserId");
window.plugins.tunePlugin.measureEvent("invite");
Unity Plugin Invite Event
using TuneSDK;
Tune.SetUserId("userId");
Tune.SetFacebookUserId("facebookUserId");
Tune.SetGoogleUserId("googleUserId");
Tune.SetTwitterUserId("twitterUserId");
Tune.MeasureEvent("invite");
Xamarin Plugin Invite Event
Android
using TuneSDK;
Tune.Instance.SetUserId("userId");
Tune.Instance.SetFacebookUserId("facebookUserId");
Tune.Instance.SetGoogleUserId("googleUserId");
Tune.Instance.SetTwitterUserId("twitterUserId");
Tune.Instance.MeasureEvent(TuneEvent.Invite);
iOS
using TuneSDK;
Tune.SetUserId ("userId");
Tune.SetFacebookUserId ("facebookId");
Tune.SetGoogleUserId ("googleId");
Tune.SetTwitterUserId ("twitterId");
Tune.MeasureEventName ("invite");
Level Achieved
The level achieved event occurs when a user completes one level and proceeds to the next (typically, in a gaming mobile app). This event shows the user engagement and can identify the skill level of the user in the game. Use the level
parameter with the event to store the value of the achieved level.
- User ID (recommended)
- Facebook User ID (recommended if authentication with Facebook)
- Twitter User ID (recommended if authentication with Twitter)
- Google User ID (recommended if authentication with Google)
- Name/ID of Level (recommended)
Android SDK Level Achieved Event
ITune tune = Tune.getInstance();
tune.setUserId("userId");
tune.setFacebookUserId("facebookUserId");
tune.setGoogleUserId("googleUserId");
tune.setTwitterUserId("twitterUserId");
tune.measureEvent(new TuneEvent(TuneEvent.LEVEL_ACHIEVED).withLevel(5));
iOS SDK Level Achieved Event
[Tune setUserId:@"US13579"];
[Tune setFacebookUserId:@"321321321321"];
[Tune setGoogleUserId:@"11223344556677"];
[Tune setTwitterUserId:@"1357924680"];
TuneEvent *event = [TuneEvent eventWithName:TUNE_EVENT_LEVEL_ACHIEVED];
event.level = 7;
[Tune measureEvent:event];
Javascript SDK Level Achieved Event
MobileAppTracker.setUserId("userId");
MobileAppTracker.setFacebookUserId("facebookUserId");
MobileAppTracker.setGoogleUserId("googleUserId");
MobileAppTracker.setTwitterUserId("twitterUserId");
MobileAppTracker.setEventLevel(5);
MobileAppTracker.measureAction({"eventName": "level_achieved"});
Windows SDK Level Achieved Event
mobileAppTracker.SetUserId("userId");
mobileAppTracker.SetFacebookUserId("facebookUserId");
mobileAppTracker.SetGoogleUserId("googleUserId");
mobileAppTracker.SetTwitterUserId("twitterUserId");
mobileAppTracker.SetEventLevel(5);
mobileAppTracker.MeasureAction("level_achieved");
Adobe Air Plugin Level Achieved Event
Tune.instance.setUserId("userId");
Tune.instance.setFacebookUserId("facebookUserId");
Tune.instance.setGoogleUserId("googleUserId");
Tune.instance.setTwitterUserId("twitterUserId");
var tuneEvent:Dictionary = new Dictionary();
tuneEvent.name = "level_achieved";
tuneEvent.level = 5;
Tune.instance.measureEvent(tuneEvent);
Cocos2dx Plugin Level Achieved Event
sdkbox::PluginTune::setUserId("userId");
sdkbox::PluginTune::setFacebookUserId("facebookUserId");
sdkbox::PluginTune::setGoogleUserId("googleUserId");
sdkbox::PluginTune::setTwitterUserId("twitterUserId");
TuneEvent event;
event.eventName = "level_achieved";
event.level = 5;
sdkbox::PluginTune::measureEvent(event);
PhoneGap Plugin Level Achieved Event
window.plugins.tunePlugin.setUserId("userId");
window.plugins.tunePlugin.setFacebookUserId("facebookUserId");
window.plugins.tunePlugin.setGoogleUserId("googleUserId");
window.plugins.tunePlugin.setTwitterUserId("twitterUserId");
var tuneEvent = {
"name": "level_achieved",
"level": 5
};
window.plugins.tunePlugin.measureEvent(tuneEvent);
Unity Plugin Level Achieved Event
using TuneSDK;
Tune.SetUserId("userId");
Tune.SetFacebookUserId("facebookUserId");
Tune.SetGoogleUserId("googleUserId");
Tune.SetTwitterUserId("twitterUserId");
TuneEvent tuneEvent = new TuneEvent("level_achieved");
tuneEvent.level = 5;
Tune.MeasureEvent(tuneEvent);
Xamarin Plugin Level Achieved Event
Android
using TuneSDK;
Tune.Instance.SetUserId("userId");
Tune.Instance.SetFacebookUserId("facebookUserId");
Tune.Instance.SetGoogleUserId("googleUserId");
Tune.Instance.SetTwitterUserId("twitterUserId");
Tune.Instance.MeasureEvent(new TuneEvent(TuneEvent.LevelAchieved).withLevel(5));
iOS
using TuneSDK;
Tune.SetUserId ("userId");
Tune.SetFacebookUserId ("facebookId");
Tune.SetGoogleUserId ("googleId");
Tune.SetTwitterUserId ("twitterId");
TuneEvent evt = TuneEvent.EventWithName ("level_achieved");
evt.Level = 5;
Tune.MeasureEvent (evt);
登录
After a successful login by the user, implement the SDK to log this event. Depending on your app, include the following values when logging the login event:
- User ID (recommended)
- User Email (recommended)
- User Name (recommended)
- Facebook User ID (recommended if authentication with Facebook)
- Twitter User ID (recommended if authentication with Twitter)
- Google User ID (recommended if authentication with Google)
- Gender (optional)
- Age (optional)
- Latitude (optional)
- Longitude (optional)
- Altitude (optional)
Android SDK Login Event
ITune tune = Tune.getInstance();
tune.setUserEmail("userEmail");
tune.setUserName("userName");
tune.setAge(35);
tune.setGender(TuneGender.MALE);
tune.setUserId("userId");
tune.setFacebookUserId("facebookUserId");
tune.setGoogleUserId("googleUserId");
tune.setTwitterUserId("twitterUserId");
tune.setLocation(location);
tune.measureEvent(TuneEvent.LOGIN);
iOS SDK Login Event
[Tune setUserEmail:@"[email protected]"];
[Tune setUserName:@"natalie123"];
[Tune setAge:43];
[Tune setGender:TuneGenderFemale];
[Tune setUserId:@"US13579"];
[Tune setFacebookUserId:@"321321321321"];
[Tune setGoogleUserId:@"11223344556677"];
[Tune setTwitterUserId:@"1357924680"];
TuneLocation *loc = [TuneLocation new];
loc.latitude = @(9.142276);
loc.longitude = @(-79.724052);
loc.altitude = @(15.);
[Tune setLocation:loc];
[Tune measureEventName:TUNE_EVENT_LOGIN];
Javascript SDK Login Event
MobileAppTracker.setUserEmail("userEmail");
MobileAppTracker.setUserName("userName");
MobileAppTracker.setUserId("userId");
MobileAppTracker.setFacebookUserId("facebookUserId");
MobileAppTracker.setGoogleUserId("googleUserId");
MobileAppTracker.setTwitterUserId("twitterUserId");
MobileAppTracker.setLatitude(47.61);
MobileAppTracker.setLongitude(-122.33);
MobileAppTracker.setAltitude(55);
MobileAppTracker.measureAction({"eventName": "login"});
Windows SDK Login Event
mobileAppTracker.SetUserEmail("userEmail");
mobileAppTracker.SetUserName("userName");
mobileAppTracker.SetAge(35);
mobileAppTracker.SetGender(MATGender.MALE);
mobileAppTracker.SetUserId("userId");
mobileAppTracker.SetFacebookUserId("facebookUserId");
mobileAppTracker.SetGoogleUserId("googleUserId");
mobileAppTracker.SetTwitterUserId("twitterUserId");
mobileAppTracker.SetLatitude(47.61);
mobileAppTracker.SetLongitude(-122.33);
mobileAppTracker.SetAltitude(55);
mobileAppTracker.MeasureAction("login");
Adobe Air Plugin Login Event
Tune.instance.setUserEmail("userEmail");
Tune.instance.setUserName("userName");
Tune.instance.setAge(35);
Tune.instance.setGender(0); // 0 is male, 1 female
Tune.instance.setUserId("userId");
Tune.instance.setFacebookUserId("facebookUserId");
Tune.instance.setGoogleUserId("googleUserId");
Tune.instance.setTwitterUserId("twitterUserId");
Tune.instance.setLocation(47.61, -122.33, 55);
Tune.instance.measureEventName("login");
Cocos2dx Plugin Login Event
sdkbox::PluginTune::setUserEmail("userEmail");
sdkbox::PluginTune::setUserId("userId");
sdkbox::PluginTune::setUserName("username");
sdkbox::PluginTune::setAge(35);
sdkbox::PluginTune::setGender(sdkbox::PluginTune::GenderMale);
sdkbox::PluginTune::setFacebookUserId("facebookUserId");
sdkbox::PluginTune::setGoogleUserId("googleUserId");
sdkbox::PluginTune::setTwitterUserId("twitterUserId");
sdkbox::PluginTune::setLatitude(47.61f, -122.33f, 55f);
sdkbox::PluginTune::measureEventName("login");
PhoneGap Plugin Login Event
window.plugins.tunePlugin.setUserEmail("userEmail");
window.plugins.tunePlugin.setUserName("userName");
window.plugins.tunePlugin.setAge(35);
window.plugins.tunePlugin.setGender(0); // 0 is male, 1 female
window.plugins.tunePlugin.setUserId("userId");
window.plugins.tunePlugin.setFacebookUserId("facebookUserId");
window.plugins.tunePlugin.setGoogleUserId("googleUserId");
window.plugins.tunePlugin.setTwitterUserId("twitterUserId");
window.plugins.tunePlugin.setLocationWithAltitude(47.61, -122.33, 55);
window.plugins.tunePlugin.measureEvent("login");
Unity Plugin Login Event
using TuneSDK;
Tune.SetUserEmail("userEmail");
Tune.SetUserName("userName");
Tune.SetAge(35);
Tune.SetGender(0); // 0 is male, 1 female
Tune.SetUserId("userId");
Tune.SetFacebookUserId("facebookUserId");
Tune.SetGoogleUserId("googleUserId");
Tune.SetTwitterUserId("twitterUserId");
Tune.SetLocation(47.61, -122.33, 55);
Tune.MeasureEvent("login");
Xamarin Plugin Login Event
Android
using TuneSDK;
Tune.Instance.SetUserEmail("userEmail");
Tune.Instance.SetUserName("userName");
Tune.Instance.SetAge(35);
Tune.Instance.SetGender(TuneGender.Male);
Tune.Instance.SetUserId("userId");
Tune.Instance.SetFacebookUserId("facebookUserId");
Tune.Instance.SetGoogleUserId("googleUserId");
Tune.Instance.SetTwitterUserId("twitterUserId");
Tune.Instance.SetLocation(location);
Tune.Instance.MeasureEvent(TuneEvent.Login);
iOS
using TuneSDK;
Tune.SetUserId ("userId");
Tune.SetFacebookUserId ("facebookId");
Tune.SetGoogleUserId ("googleId");
Tune.SetTwitterUserId ("twitterId");
Tune.SetAge (age);
Tune.SetGender (gender); // 0 for male, 1 for female, 2 for other
TuneLocation sampleLocation = new TuneLocation ();
sampleLocation.SetLatitude (latitude);
sampleLocation.SetLongitude (longitude);
sampleLocation.SetAltitude (altitude);
Tune.SetLocation (sampleLocation);
Tune.MeasureEventName("login");
购买
The purchase event occurs when a user completes the checkout process. If these purchase events are for in-app purchases, then use our in-app purchase verification with this event as well. Each SKU or line item in the shopping cart should have its own event item.
注意
You can also setup the SDK to collect in-app purchase validation receipts from both the Apple App Store and Google Play Store.
- User ID (recommended)
- Facebook User ID (recommended if authentication with Facebook)
- Twitter User ID (recommended if authentication with Twitter)
- Google User ID (recommended if authentication with Google)
- Latitude (optional)
- Longitude (optional)
- Altitude (optional)
- Event Items Array of event items passed into measureEvent (recommended)
- Event item (SKU) for a purchase should include:
- Name – name of the item
- Product ID – SKU
- Unit Price – individual price of one unit
- Quantity – number of items purchased
- Revenue – total value of the purchase
- Event item (SKU) for a purchase should include:
- Order or Receipt ID (recommended; passed as referenceID into measureEvent)
- Revenue (recommended; passed into measureAction)
注意
You can also pass a negative purchase value to reflect transactions like refunds. This negative value will also be included in the Sum total in reporting.
- Currency Code (recommended if Revenue set; passed into measureEvent)
注意
In-App Marketing does not support events or event item data for Purchase.
Android SDK Purchase Event
ITune tune = Tune.getInstance();
tune.setUserId("userId");
tune.setFacebookUserId("facebookUserId");
tune.setGoogleUserId("googleUserId");
tune.setTwitterUserId("twitterUserId");
tune.setLocation(location);
tune.measureEvent(new TuneEvent(TuneEvent.PURCHASE)
.withEventItems(eventItems)
.withRevenue(0.99)
.withCurrencyCode("USD")
.withAdvertiserRefId("12999748531"));
iOS SDK Purchase Event
TuneEventItem *item1 = [TuneEventItem eventItemWithName:@"ball1" unitPrice:3.99 quantity:2];
TuneEventItem *item2 = [TuneEventItem eventItemWithName:@"ball2" unitPrice:9.99 quantity:1 revenue:9.99 attribute1:@"red" attribute2:@"inflatable" attribute3:@"rubber" attribute4:nil attribute5:nil];
NSArray *eventItems = @[item1, item2];
[Tune setUserId:@"US13579"];
[Tune setFacebookUserId:@"321321321321"];
[Tune setGoogleUserId:@"11223344556677"];
[Tune setTwitterUserId:@"1357924680"];
TuneLocation *loc = [TuneLocation new];
loc.latitude = @(9.142276);
loc.longitude = @(-79.724052);
loc.altitude = @(15.);
[Tune setLocation:loc];
TuneEvent *event = [TuneEvent eventWithName:TUNE_EVENT_PURCHASE];
event.eventItems = eventItems;
event.refId = @"ref13571";
event.revenue = 13.97;
event.currencyCode = @"USD";
[Tune measureEvent:event];
Javascript SDK Purchase Event
MobileAppTracker.setUserId("userId");
MobileAppTracker.setFacebookUserId("facebookUserId");
MobileAppTracker.setGoogleUserId("googleUserId");
MobileAppTracker.setTwitterUserId("twitterUserId");
MobileAppTracker.setLatitude(47.61);
MobileAppTracker.setLongitude(-122.33);
MobileAppTracker.setAltitude(55);
MobileAppTracker.measureAction({"eventName": "purchase",
"revenue": 0.99,
"currencyCode": "USD",
"referenceId": "12999748531",
"eventItems": eventItems});
Windows SDK Purchase Event
mobileAppTracker.SetUserId("userId");
mobileAppTracker.SetFacebookUserId("facebookUserId");
mobileAppTracker.SetGoogleUserId("googleUserId");
mobileAppTracker.SetTwitterUserId("twitterUserId");
mobileAppTracker.SetLatitude(47.61);
mobileAppTracker.SetLongitude(-122.33);
mobileAppTracker.SetAltitude(55);
mobileAppTracker.MeasureAction("purchase", 0.99, "USD", "12999748531", eventItems);
Adobe Air Plugin Purchase Event
Tune.instance.setUserId("userId");
Tune.instance.setFacebookUserId("facebookUserId");
Tune.instance.setGoogleUserId("googleUserId");
Tune.instance.setTwitterUserId("twitterUserId");
Tune.instance.setLocation(47.61, -122.33, 55);
var tuneEvent:Dictionary = new Dictionary();
tuneEvent.name = "purchase";
tuneEvent.revenue = 0.99;
tuneEvent.currency = "USD";
tuneEvent.advertiserRefId = "12999748531";
tuneEvent.eventItems = eventItems;
Tune.instance.measureEvent(tuneEvent);
Cocos2dx Plugin Purchase Event
sdkbox::PluginTune::setUserId("userId");
sdkbox::PluginTune::setFacebookUserId("facebookUserId");
sdkbox::PluginTune::setGoogleUserId("googleUserId");
sdkbox::PluginTune::setTwitterUserId("twitterUserId");
sdkbox::PluginTune::setLatitude(47.61f, -122.33f, 55f);
TuneEvent event;
event.eventName = "purchase";
event.revenue = 0.99;
event.currencyCode = "USD";
event.refId = "12999748531";
event.eventItems = eventItems;
sdkbox::PluginTune::measureEvent(event);
PhoneGap Plugin Purchase Event
window.plugins.tunePlugin.setUserId("userId");
window.plugins.tunePlugin.setFacebookUserId("facebookUserId");
window.plugins.tunePlugin.setGoogleUserId("googleUserId");
window.plugins.tunePlugin.setTwitterUserId("twitterUserId");
window.plugins.tunePlugin.setLocationWithAltitude(47.61, -122.33, 55);
var tuneEvent = {
"name": "purchase",
"eventItems": eventItems,
"revenue": 0.99,
"currency": "USD",
"advertiserRefId": "12999748531"
};
window.plugins.tunePlugin.measureEvent(tuneEvent);
Unity Plugin Purchase Event
using TuneSDK;
Tune.SetUserId("userId");
Tune.SetFacebookUserId("facebookUserId");
Tune.SetGoogleUserId("googleUserId");
Tune.SetTwitterUserId("twitterUserId");
Tune.SetLocation(47.61, -122.33, 55);
TuneEvent tuneEvent = new TuneEvent("purchase");
tuneEvent.eventItems = eventItems;
tuneEvent.revenue = 0.99;
tuneEvent.currencyCode = "USD";
tuneEvent.advertiserRefId = "12999748531";
Tune.MeasureEvent(tuneEvent);
Xamarin Plugin Purchase Event
Android
using TuneSDK;
Tune.Instance.SetUserId("userId");
Tune.Instance.SetFacebookUserId("facebookUserId");
Tune.Instance.SetGoogleUserId("googleUserId");
Tune.Instance.SetTwitterUserId("twitterUserId");
Tune.Instance.SetLocation(location);
Tune.Instance.MeasureEvent(new TuneEvent(TuneEvent.Purchase)
.WithEventItems(eventItems)
.WithRevenue(0.99)
.WithCurrencyCode("USD")
.WithAdvertiserRefId("12999748531"));
iOS
using TuneSDK;
Tune.SetUserId ("userId");
Tune.SetFacebookUserId ("facebookId");
Tune.SetGoogleUserId ("googleId");
Tune.SetTwitterUserId ("twitterId");
Tune.SetAge (age);
Tune.SetGender (gender); // 0 for male, 1 for female, 2 for other
TuneLocation sampleLocation = new TuneLocation ();
sampleLocation.SetLatitude (latitude);
sampleLocation.SetLongitude (longitude);
sampleLocation.SetAltitude (altitude);
Tune.SetLocation (sampleLocation);
TuneEvent evt = TuneEvent.EventWithName ("purchase");
evt.RefId = "ref10";
evt.CurrencyCode = "USD";
evt.Revenue = 132.6f;
evt.TransactionState = 0; // from StoreKit transaction state
evt.Receipt = iTunesIAPReceipt;
TuneEventItem item1 = TuneEventItem.EventItemWithName("item1", 0.99f, 1, 0.99f, "red", "inflatable", "rubber", "", "");
TuneEventItem item2 = TuneEventItem.EventItemWithName("item2", 0.50f, 2, 1.0f);
evt.EventItems = new TuneEventItem[] { item1, item2 };
Tune.MeasureEvent(evt);
Rated
Include the following values when logging the Rating event:
- User ID (recommended)
- Facebook User ID (recommended if authentication with Facebook)
- Twitter User ID (recommended if authentication with Twitter)
- Google User ID (recommended if authentication with Google)
- Rating Value (recommended)
- Content Name or ID (optional if rating content)
Android SDK Rated Event
ITune tune = Tune.getInstance();
tune.setUserId("userId");
tune.setFacebookUserId("facebookUserId");
tune.setGoogleUserId("googleUserId");
tune.setTwitterUserId("twitterUserId");
tune.measureEvent(new TuneEvent(TuneEvent.RATED)
.withRating(4.5)
.withContentId("5658"));
Javascript SDK Rated Event
MobileAppTracker.setUserId("userId");
MobileAppTracker.setFacebookUserId("facebookUserId");
MobileAppTracker.setGoogleUserId("googleUserId");
MobileAppTracker.setTwitterUserId("twitterUserId");
MobileAppTracker.setEventRating(4.5);
MobileAppTracker.setEventContentId("5658");
MobileAppTracker.measureAction({"eventName": "rated"});
Windows SDK Rated Event
mobileAppTracker.SetUserId("userId");
mobileAppTracker.SetFacebookUserId("facebookUserId");
mobileAppTracker.SetGoogleUserId("googleUserId");
mobileAppTracker.SetTwitterUserId("twitterUserId");
mobileAppTracker.SetEventRating(4.5);
mobileAppTracker.SetEventContentId("5658");
mobileAppTracker.MeasureAction("rated");
Adobe Air Plugin Rated Event
Tune.instance.setUserId("userId");
Tune.instance.setFacebookUserId("facebookUserId");
Tune.instance.setGoogleUserId("googleUserId");
Tune.instance.setTwitterUserId("twitterUserId");
var tuneEvent:Dictionary = new Dictionary();
tuneEvent.name = "rated";
tuneEvent.rating = 4.5;
tuneEvent.contentId = "5658";
Tune.instance.measureEvent(tuneEvent);
Cocos2dx Plugin Rated Event
sdkbox::PluginTune::setUserId("userId");
sdkbox::PluginTune::setFacebookUserId("facebookUserId");
sdkbox::PluginTune::setGoogleUserId("googleUserId");
sdkbox::PluginTune::setTwitterUserId("twitterUserId");
TuneEvent event;
event.eventName = "rated";
event.rating = 4.5;
event.contentId = "5658";
sdkbox::PluginTune::measureEvent(event);
PhoneGap Plugin Rated Event
window.plugins.tunePlugin.setUserId("userId");
window.plugins.tunePlugin.setFacebookUserId("facebookUserId");
window.plugins.tunePlugin.setGoogleUserId("googleUserId");
window.plugins.tunePlugin.setTwitterUserId("twitterUserId");
var tuneEvent = {
"name": "rated",
"rating": 4.5,
"contentId": "5658"
};
window.plugins.tunePlugin.measureEvent(tuneEvent);
Unity Plugin Rated Event
using TuneSDK;
Tune.SetUserId("userId");
Tune.SetFacebookUserId("facebookUserId");
Tune.SetGoogleUserId("googleUserId");
Tune.SetTwitterUserId("twitterUserId");
TuneEvent tuneEvent = new TuneEvent("rated");
tuneEvent.rating = 4.5;
tuneEvent.contentId = "5658";
Tune.MeasureEvent(tuneEvent);
Xamarin Plugin Rated Event
Android
using TuneSDK;
Tune.Instance.SetUserId("userId");
Tune.Instance.SetFacebookUserId("facebookUserId");
Tune.Instance.SetGoogleUserId("googleUserId");
Tune.Instance.SetTwitterUserId("twitterUserId");
Tune.Instance.MeasureEvent(new TuneEvent(TuneEvent.Rated)
.WithRating(4.5)
.WithContentId("5658"));
iOS
using TuneSDK;
Tune.SetUserId ("userId");
Tune.SetFacebookUserId ("facebookId");
Tune.SetGoogleUserId ("googleId");
Tune.SetTwitterUserId ("twitterId");
TuneEvent evt = TuneEvent.EventWithName ("rated");
evt.Rating = 5f;
evt.ContentId = "itemId"
Tune.MeasureEvent (evt);
注册
After a successful registration by the user, implement the SDK to log this event. Depending on your app, include the following values when logging the registration event:
- User ID (recommended)
- User Email (recommended)
- User Name (recommended)
- Facebook User ID (recommended if authentication with Facebook)
- Twitter User ID (recommended if authentication with Twitter)
- Google User ID (recommended if authentication with Google)
- Gender (optional)
- Age (optional)
- Latitude (optional)
- Longitude (optional)
- Altitude (optional)
Android SDK Registration Event
ITune tune = Tune.getInstance();
tune.setUserEmail("userEmail");
tune.setUserName("userName");
tune.setAge(35);
tune.setGender(TuneGender.MALE);
tune.setUserId("userId");
tune.setFacebookUserId("facebookUserId");
tune.setGoogleUserId("googleUserId");
tune.setTwitterUserId("twitterUserId");
tune.setLocation(location);
tune.measureEvent(TuneEvent.REGISTRATION);
iOS SDK Registration Event
[Tune setUserEmail:@"[email protected]"];
[Tune setUserName:@"natalie123"];
[Tune setAge:43];
[Tune setGender:TuneGenderFemale];
[Tune setUserId:@"US13579"];
[Tune setFacebookUserId:@"321321321321"];
[Tune setGoogleUserId:@"11223344556677"];
[Tune setTwitterUserId:@"1357924680"];
TuneLocation *loc = [TuneLocation new];
loc.latitude = @(9.142276);
loc.longitude = @(-79.724052);
loc.altitude = @(15.);
[Tune setLocation:loc];
[Tune measureEventName:TUNE_EVENT_REGISTRATION];
Javascript SDK Registration Event
MobileAppTracker.setUserEmail("userEmail");
MobileAppTracker.setUserName("userName");
MobileAppTracker.setUserId("userId");
MobileAppTracker.setFacebookUserId("facebookUserId");
MobileAppTracker.setGoogleUserId("googleUserId");
MobileAppTracker.setTwitterUserId("twitterUserId");
MobileAppTracker.setLatitude(47.61);
MobileAppTracker.setLongitude(-122.33);
MobileAppTracker.setAltitude(55);
MobileAppTracker.measureAction({"eventName": "registration"});
Windows SDK Registration Event
mobileAppTracker.SetUserEmail("userEmail");
mobileAppTracker.SetUserName("userName");
mobileAppTracker.SetAge(35);
mobileAppTracker.SetGender(MATGender.MALE);
mobileAppTracker.SetUserId("userId");
mobileAppTracker.SetFacebookUserId("facebookUserId");
mobileAppTracker.SetGoogleUserId("googleUserId");
mobileAppTracker.SetTwitterUserId("twitterUserId");
mobileAppTracker.SetLatitude(47.61);
mobileAppTracker.SetLongitude(-122.33);
mobileAppTracker.SetAltitude(55);
mobileAppTracker.MeasureAction("registration");
Adobe Air Plugin Registration Event
Tune.instance.setUserEmail("userEmail");
Tune.instance.setUserName("userName");
Tune.instance.setAge(35);
Tune.instance.setGender(0); // 0 is male, 1 female
Tune.instance.setUserId("userId");
Tune.instance.setFacebookUserId("facebookUserId");
Tune.instance.setGoogleUserId("googleUserId");
Tune.instance.setTwitterUserId("twitterUserId");
Tune.instance.setLocation(47.61, -122.33, 55);
Tune.instance.measureEventName("registration");
Cocos2dx Plugin Registration Event
sdkbox::PluginTune::setUserEmail("userEmail");
sdkbox::PluginTune::setUserId("userId");
sdkbox::PluginTune::setUserName("username");
sdkbox::PluginTune::setAge(35);
sdkbox::PluginTune::setGender(sdkbox::PluginTune::GenderMale);
sdkbox::PluginTune::setFacebookUserId("facebookUserId");
sdkbox::PluginTune::setGoogleUserId("googleUserId");
sdkbox::PluginTune::setTwitterUserId("twitterUserId");
sdkbox::PluginTune::setLatitude(47.61f, -122.33f, 55f);
sdkbox::PluginTune::measureEventName("registration");
PhoneGap Plugin Registration Event
window.plugins.tunePlugin.setUserEmail("userEmail");
window.plugins.tunePlugin.setUserName("userName");
window.plugins.tunePlugin.setAge(35);
window.plugins.tunePlugin.setGender(0); // 0 is male, 1 female
window.plugins.tunePlugin.setUserId("userId");
window.plugins.tunePlugin.setFacebookUserId("facebookUserId");
window.plugins.tunePlugin.setGoogleUserId("googleUserId");
window.plugins.tunePlugin.setTwitterUserId("twitterUserId");
window.plugins.tunePlugin.setLocationWithAltitude(47.61, -122.33, 55);
window.plugins.tunePlugin.measureEvent("registration");
Unity Plugin Registration Event
using TuneSDK;
Tune.SetUserEmail("userEmail");
Tune.SetUserName("userName");
Tune.SetAge(35);
Tune.SetGender(0); // 0 is male, 1 female
Tune.SetUserId("userId");
Tune.SetFacebookUserId("facebookUserId");
Tune.SetGoogleUserId("googleUserId");
Tune.SetTwitterUserId("twitterUserId");
Tune.SetLocation(47.61, -122.33, 55);
Tune.MeasureEvent("registration");
Xamarin Plugin Registration Event
Android
using TuneSDK;
Tune.Instance.SetUserEmail("userEmail");
Tune.Instance.SetUserName("userName");
Tune.Instance.SetAge(35);
Tune.Instance.SetGender(TuneGender.Male);
Tune.Instance.SsetUserId("userId");
Tune.Instance.SetFacebookUserId("facebookUserId");
Tune.Instance.SetGoogleUserId("googleUserId");
Tune.Instance.SetTwitterUserId("twitterUserId");
Tune.Instance.SetLocation(location);
Tune.Instance.MeasureEvent(TuneEvent.Registration);
iOS
using TuneSDK;
Tune.SetUserEmail("[email protected]");
Tune.SetUserName("userName");
Tune.SetUserId ("userId");
Tune.SetFacebookUserId ("facebookId");
Tune.SetGoogleUserId ("googleId");
Tune.SetTwitterUserId ("twitterId");
Tune.SetAge (age);
Tune.SetGender (gender); // 0 for male, 1 for female, 2 for other
TuneLocation sampleLocation = new TuneLocation ();
sampleLocation.SetLatitude (latitude);
sampleLocation.SetLongitude (longitude);
sampleLocation.SetAltitude (altitude);
Tune.SetLocation (sampleLocation);
Tune.MeasureEventName ("registration");
预定
Use the reservation event for travel and entertainment-related mobile apps. You can use the EventAttribute3
parameter for a check in (reservation date), EventAttribute4
for multi-day reservations, and EventAttribute5
for the number of guests count.
Use the Advertiser Reference ID parameter for the reservation number or Order ID.
You can also set Revenue and Currency Code attributes to help determine the value of your advertising partners.
- User ID (recommended)
- Facebook User ID (recommended if authentication with Facebook)
- Twitter User ID (recommended if authentication with Twitter)
- Google User ID (recommended if authentication with Google)
- Gender (optional)
- Age (optional)
- Latitude (optional)
- Longitude (optional)
- Altitude (optional)
- Time of Check In set in Date1 (recommended; recommend date time format of yyyy-mm-dd hh:mm:ss)
- Time of Check Out set with Date2 (recommended; recommend date time format of yyyy-mm-dd hh:mm:ss)
- Count of Guests set with Quantity (recommended)
- Revenue (recommended; passed into measureEvent)
- Currency Code (recommended if Revenue set; passed into measureEvent)
- Reservation Number (recommended; passed as referenceID into measureEvent)
Android SDK Reservation Event
ITune tune = Tune.getInstance();
tune.setUserId("userId");
tune.setFacebookUserId("facebookUserId");
tune.setGoogleUserId("googleUserId");
tune.setTwitterUserId("twitterUserId");
tune.setAge(35);
tune.setGender(TuneGender.MALE);
tune.setLocation(location);
tune.measureEvent(new TuneEvent(TuneEvent.RESERVATION)
.withRevenue(49.99)
.withCurrencyCode("USD")
.withAdvertiserRefId("12999748531")
.withDate1(new GregorianCalendar(2015, 4, 21).getTime())
.withDate2(new GregorianCalendar(2015, 4, 23).getTime())
.withQuantity(3));
iOS SDK Reservation Event
[Tune setUserId:@"US13579"];
[Tune setFacebookUserId:@"321321321321"];
[Tune setGoogleUserId:@"11223344556677"];
[Tune setTwitterUserId:@"1357924680"];
[Tune setAge:43];
[Tune setGender:TuneGenderFemale];
TuneLocation *loc = [TuneLocation new];
loc.latitude = @(9.142276);
loc.longitude = @(-79.724052);
loc.altitude = @(15.);
[Tune setLocation:loc];
TuneEvent *event = [TuneEvent eventWithName:TUNE_EVENT_RESERVATION];
event.date1 = [NSDate date];
event.date2 = [NSDate dateWithTimeIntervalSinceNow:86400];
event.quantity = 2;
event.refId = @"KJ9872";
event.revenue = 129.0;
event.currencyCode = @"USD";
[Tune measureEvent:event];
Javascript SDK Reservation Event
MobileAppTracker.setUserId("userId");
MobileAppTracker.setFacebookUserId("facebookUserId");
MobileAppTracker.setGoogleUserId("googleUserId");
MobileAppTracker.setTwitterUserId("twitterUserId");
MobileAppTracker.setLatitude(47.61);
MobileAppTracker.setLongitude(-122.33);
MobileAppTracker.setAltitude(55);
MobileAppTracker.setEventDate1(new Date(2015,4,21).getTime());
MobileAppTracker.setEventDate2(new Date(2015,4,23).getTime());
MobileAppTracker.setEventQuantity(3);
MobileAppTracker.measureAction({"eventName": "reservation",
"revenue": 49.99,
"currencyCode": "USD",
"referenceId": "12999748531"});
Windows SDK Reservation Event
mobileAppTracker.SetUserId("userId");
mobileAppTracker.SetFacebookUserId("facebookUserId");
mobileAppTracker.SetGoogleUserId("googleUserId");
mobileAppTracker.SetTwitterUserId("twitterUserId");
mobileAppTracker.SetAge(35);
mobileAppTracker.SetGender(MATGender.MALE);
mobileAppTracker.SetLatitude(47.61);
mobileAppTracker.SetLongitude(-122.33);
mobileAppTracker.SetAltitude(55);
mobileAppTracker.SetEventDate1(checkInTime);
mobileAppTracker.SetEventDate2(checkOutTime);
mobileAppTracker.SetEventQuantity(3);
mobileAppTracker.MeasureAction("reservation", 49.99, "USD", "12999748531");
Adobe Air Plugin Reservation Event
Tune.instance.setUserId("userId");
Tune.instance.setFacebookUserId("facebookUserId");
Tune.instance.setGoogleUserId("googleUserId");
Tune.instance.setTwitterUserId("twitterUserId");
Tune.instance.setAge(35);
Tune.instance.setGender(0); // 0 is male, 1 female
Tune.instance.setLocation(47.61, -122.33, 55);
var tuneEvent:Dictionary = new Dictionary();
tuneEvent.name = "reservation";
tuneEvent.revenue = 49.99;
tuneEvent.currency = "USD";
tuneEvent.refId = "12999748531";
tuneEvent.date1 = Date.UTC(2015, 4, 21).toString();
tuneEvent.date2 = Date.UTC(2015, 4, 23).toString();
tuneEvent.quantity = 3;
Tune.instance.measureEvent(tuneEvent);
Cocos2dx Plugin Reservation Event
sdkbox::PluginTune::setUserId("userId");
sdkbox::PluginTune::setFacebookUserId("facebookUserId");
sdkbox::PluginTune::setGoogleUserId("googleUserId");
sdkbox::PluginTune::setTwitterUserId("twitterUserId");
sdkbox::PluginTune::setGender(sdkbox::PluginTune::GenderMale);
sdkbox::PluginTune::setAge(35);
sdkbox::PluginTune::setLatitude(47.61f, -122.33f, 55f);
TuneEvent event;
event.eventName = "reservation";
event.revenue = 49.99;
event.currencyCode = "USD";
event.refId = "12999748531";
event.timeIntervalSince1970Date1 = 1437167569;
event.timeIntervalSince1970Date2 = 1437167569;
event.quantity = 3;
sdkbox::PluginTune::measureEvent(event);
PhoneGap Plugin Reservation Event
window.plugins.tunePlugin.setUserId("userId");
window.plugins.tunePlugin.setFacebookUserId("facebookUserId");
window.plugins.tunePlugin.setGoogleUserId("googleUserId");
window.plugins.tunePlugin.setTwitterUserId("twitterUserId");
window.plugins.tunePlugin.setAge(35);
window.plugins.tunePlugin.setGender(0); // 0 is male, 1 female
window.plugins.tunePlugin.setLocationWithAltitude(47.61, -122.33, 55);
var tuneEvent = {
"name": "reservation",
"date1": new Date(2015,4,21).getTime(),
"date2": new Date(2015,4,23).getTime(),
"quantity": 3
};
window.plugins.tunePlugin.measureEvent(tuneEvent);
Unity Plugin Reservation Event
using TuneSDK;
Tune.SetUserId("userId");
Tune.SetFacebookUserId("facebookUserId");
Tune.SetGoogleUserId("googleUserId");
Tune.SetTwitterUserId("twitterUserId");
Tune.SetAge(35);
Tune.SetGender(0); // 0 is male, 1 female
Tune.SetLocation(47.61, -122.33, 55);
TuneEvent tuneEvent = new TuneEvent("reservation");
tuneEvent.date1 = new DateTime(2015, 4, 21);
tuneEvent.date2 = new DateTime(2015, 4, 23);
tuneEvent.quantity = 3;
tuneEvent.revenue = 49.99;
tuneEvent.currencyCode = "USD";
tuneEvent.advertiserRefId = "12999748531";
Tune.MeasureEvent(tuneEvent);
Xamarin Plugin Reservation Event
Android
using TuneSDK;
Tune.Instance.SetUserId("userId");
Tune.Instance.SetFacebookUserId("facebookUserId");
Tune.Instance.SetGoogleUserId("googleUserId");
Tune.Instance.SetTwitterUserId("twitterUserId");
Tune.Instance.SetAge(35);
Tune.Instance.SetGender(TuneGender.Male);
Tune.Instance.SetLocation(location);
Tune.Instance.MeasureEvent(new TuneEvent(TuneEvent.Reservation)
.WithRevenue(49.99)
.WithCurrencyCode("USD")
.WithAdvertiserRefId("12999748531")
.WithDate1(checkInTime)
.WithDate2(checkOutTime)
.WithQuantity(3));
iOS
using TuneSDK;
Tune.SetUserId ("userId");
Tune.SetFacebookUserId ("facebookId");
Tune.SetGoogleUserId ("googleId");
Tune.SetTwitterUserId ("twitterId");
Tune.SetAge (age);
Tune.SetGender (gender); // 0 for male, 1 for female, 2 for other
TuneLocation sampleLocation = new TuneLocation ();
sampleLocation.SetLatitude (latitude);
sampleLocation.SetLongitude (longitude);
sampleLocation.SetAltitude (altitude);
Tune.SetLocation (sampleLocation);
TuneEvent evt = TuneEvent.EventWithName ("reservation");
evt.Date1 = checkInTime;
evt.Date2 = checkOutTime;
evt.Quantity = guestCount;
evt.RefId = reservationId;
evt.Revenue = 49.99f;
evt.CurrencyCode = "USD";
Tune.MeasureEvent(evt);
搜索
When a user completes a search in your app, you will want to collect the keywords they used. We recommend passing in the top 5 search results as event items as well as the options to set the check in, check out and guest count, for travel / entertainment apps.
- User ID (recommended)
- Facebook User ID (recommended if authentication with Facebook)
- Twitter User ID (recommended if authentication with Twitter)
- Google User ID (recommended if authentication with Google)
- Latitude (optional)
- Longitude (optional)
- Altitude (optional)
- Currency Code (optional)
- Search term, search keywords, query set with SearchString (optional; formatted as a string)
- Time of Check In set with Date1 (recommended; recommend date time format of yyyy-mm-dd hh:mm:ss)
- Time of Check Out set with Date2 (recommended; recommend date time format of yyyy-mm-dd hh:mm:ss)
- Count of Guests set with Quantity (recommended)
- Top 5 Search Results (recommended; create an array of event items, one for each search result in the top 5 and pass into measureEvent)
- If this search is for a product, event item should also include:
- Name – name of the item
- Product ID – SKU
- Unit Price – individual price of one unit
- Quantity – number of items purchased
- Revenue – total value of the purchase
- If this search is for a product, event item should also include:
注意
In-App Marketing does not support events or event item data for Search.
Android SDK Search Event
ITune tune = Tune.getInstance();
tune.setUserId("userId");
tune.setFacebookUserId("facebookUserId");
tune.setGoogleUserId("googleUserId");
tune.setTwitterUserId("twitterUserId");
tune.setLocation(location);
tune.measureEvent(new TuneEvent(TuneEvent.SEARCH)
.withCurrencyCode("USD")
.withEventItems(eventItems)
.withSearchString("hotel")
.withDate1(new GregorianCalendar(2015, 4, 21).getTime())
.withDate2(new GregorianCalendar(2015, 4, 23).getTime())
.withQuantity(3));
iOS SDK Search Event
TuneEventItem *item1 = [TuneEventItem eventItemWithName:@"deluxe room" unitPrice:129.99 quantity:1 revenue:129.99 attribute1:@"double" attribute2:@"free wifi" attribute3:@"view" attribute4:@"gym" attribute5:nil];
NSArray *eventItems = @[item1];
[Tune setUserId:@"US13579"];
[Tune setFacebookUserId:@"321321321321"];
[Tune setGoogleUserId:@"11223344556677"];
[Tune setTwitterUserId:@"1357924680"];
TuneLocation *loc = [TuneLocation new];
loc.latitude = @(9.142276);
loc.longitude = @(-79.724052);
loc.altitude = @(15.);
[Tune setLocation:loc];
TuneEvent *event = [TuneEvent eventWithName:TUNE_EVENT_SEARCH];
event.currencyCode = @"USD";
event.searchString = @"hotel";
event.date1 = [NSDate date];
event.date2 = [NSDate dateWithTimeIntervalSinceNow:86400];
event.quantity = 2;
event.eventItems = eventItems;
[Tune measureEvent:event];
Javascript SDK Search Event
MobileAppTracker.setUserId("userId");
MobileAppTracker.setFacebookUserId("facebookUserId");
MobileAppTracker.setGoogleUserId("googleUserId");
MobileAppTracker.setTwitterUserId("twitterUserId");
MobileAppTracker.setLatitude(47.61);
MobileAppTracker.setLongitude(-122.33);
MobileAppTracker.setAltitude(55);
MobileAppTracker.setCurrencyCode("USD");
MobileAppTracker.setEventSearchString("hotel");
MobileAppTracker.setEventDate1(new Date(2015,4,21).getTime());
MobileAppTracker.setEventDate2(new Date(2015,4,23).getTime());
MobileAppTracker.setEventQuantity(3);
MobileAppTracker.measureAction({"eventName": "search",
"eventItems": eventItems});
Windows SDK Search Event
mobileAppTracker.SetUserId("userId");
mobileAppTracker.SetFacebookUserId("facebookUserId");
mobileAppTracker.SetGoogleUserId("googleUserId");
mobileAppTracker.SetTwitterUserId("twitterUserId");
mobileAppTracker.SetLatitude(47.61);
mobileAppTracker.SetLongitude(-122.33);
mobileAppTracker.SetAltitude(55);
mobileAppTracker.SetEventSearchString("hotel");
mobileAppTracker.SetEventDate1(checkInTime);
mobileAppTracker.SetEventDate2(checkOutTime);
mobileAppTracker.SetEventQuantity(3);
mobileAppTracker.MeasureAction("search", 0, "USD", null, eventItems);
Adobe Air Plugin Search Event
Tune.instance.setUserId("userId");
Tune.instance.setFacebookUserId("facebookUserId");
Tune.instance.setGoogleUserId("googleUserId");
Tune.instance.setTwitterUserId("twitterUserId");
Tune.instance.setLocation(47.61, -122.33, 55);
var tuneEvent:Dictionary = new Dictionary();
tuneEvent.name = "search";
tuneEvent.currency = "USD";
tuneEvent.searchString = "hotel";
tuneEvent.date1 = Date.UTC(2015, 4, 21).toString();
tuneEvent.date2 = Date.UTC(2015, 4, 23).toString();
tuneEvent.quantity = 3;
tuneEvent.eventItems = eventItems;
Tune.instance.measureEvent(tuneEvent);
Cocos2dx Plugin Search Event
sdkbox::PluginTune::setUserId("userId");
sdkbox::PluginTune::setFacebookUserId("facebookUserId");
sdkbox::PluginTune::setGoogleUserId("googleUserId");
sdkbox::PluginTune::setTwitterUserId("twitterUserId");
sdkbox::PluginTune::setLatitude(47.61f, -122.33f, 55f);
TuneEvent event;
event.eventName = "search";
event.searchString = "hotel";
event.quantity = 3;
event.timeIntervalSince1970Date1 = 1437168199;
event.timeIntervalSince1970Date2 = 1437168200;
event.eventItems = eventItems;
sdkbox::PluginTune::measureEvent(event);
PhoneGap Plugin Search Event
window.plugins.tunePlugin.setUserId("userId");
window.plugins.tunePlugin.setFacebookUserId("facebookUserId");
window.plugins.tunePlugin.setGoogleUserId("googleUserId");
window.plugins.tunePlugin.setTwitterUserId("twitterUserId");
window.plugins.tunePlugin.setLocationWithAltitude(47.61, -122.33, 55);
var tuneEvent = {
"name": "search",
"currency": "USD",
"eventItems": eventItems,
"searchString": "hotel",
"date1": new Date(2015,4,21).getTime(),
"date2": new Date(2015,4,23).getTime(),
"quantity": 3
};
window.plugins.tunePlugin.measureEvent(tuneEvent);
Unity Plugin Search Event
using TuneSDK;
Tune.SetUserId("userId");
Tune.SetFacebookUserId("facebookUserId");
Tune.SetGoogleUserId("googleUserId");
Tune.SetTwitterUserId("twitterUserId");
Tune.SetLocation(47.61, -122.33, 55);
TuneEvent tuneEvent = new TuneEvent("search");
tuneEvent.eventItems = eventItems;
tuneEvent.searchString = "hotel";
tuneEvent.date1 = new DateTime(2015, 4, 21);
tuneEvent.date2 = new DateTime(2015, 4, 23);
tuneEvent.quantity = 3;
Tune.MeasureEvent(tuneEvent);
Xamarin Plugin Search Event
Android
using TuneSDK;
Tune.Instance.SetUserId("userId");
Tune.Instance.SetFacebookUserId("facebookUserId");
Tune.Instance.SetGoogleUserId("googleUserId");
Tune.Instance.SetTwitterUserId("twitterUserId");
Tune.Instance.SetLocation(location);
Tune.Instance.MeasureEvent(new TuneEvent(TuneEvent.Search)
.WithCurrencyCode("USD")
.WithEventItems(eventItems)
.WithSearchString("hotel")
.WithDate1(new GregorianCalendar(2015, 4, 21).getTime())
.WithDate2(new GregorianCalendar(2015, 4, 23).getTime())
.WithQuantity(3));
iOS
using TuneSDK;
Tune.SetUserId ("userId");
Tune.SetFacebookUserId ("facebookId");
Tune.SetGoogleUserId ("googleId");
Tune.SetTwitterUserId ("twitterId");
TuneLocation sampleLocation = new TuneLocation ();
sampleLocation.SetLatitude (latitude);
sampleLocation.SetLongitude (longitude);
sampleLocation.SetAltitude (altitude);
Tune.SetLocation (sampleLocation);
TuneEvent evt = TuneEvent.EventWithName ("search");
evt.SearchString = "testSearchString";
evt.Date1 = checkInTime;
evt.Date2 = checkOutTime;
evt.Quantity = guestCount;
evt.CurrencyCode = "USD";
TuneEventItem item1 = TuneEventItem.EventItemWithName("item1", 99.99f, 1, 90.99f, "attribute1", "attribute2", "", "", "");
TuneEventItem item2 = TuneEventItem.EventItemWithName("item2", 199.99f, 1, 190.99f, "attribute1", "attribute2", "", "", "");
TuneEventItem item3 = TuneEventItem.EventItemWithName("item3", 89.99f, 1, 80.99f, "attribute1", "attribute2", "", "", "");
TuneEventItem item4 = TuneEventItem.EventItemWithName("item4", 299.99f, 1, 290.99f, "attribute1", "attribute2", "", "", "");
TuneEventItem item5 = TuneEventItem.EventItemWithName("item5", 399.99f, 1, 390.99f, "attribute1", "attribute2", "", "", "");
evt.EventItems = new TuneEventItem[] { item1, item2, item3, item4, item5 };
Tune.MeasureEvent(evt);
分享
The Share event is when a user shared content, e.g. a product, with their friends via email or their social network. This event should be tracked once the sharing action is completed by the user. This can help you determine which of your users are loyal and point to the user’s engagement with your app.
- User ID (recommended)
- Facebook User ID (recommended if authentication with Facebook)
- Twitter User ID (recommended if authentication with Twitter)
- Google User ID (recommended if authentication with Google)
Android SDK Share Event
ITune tune = Tune.getInstance();
tune.setUserId("userId");
tune.setFacebookUserId("facebookUserId");
tune.setGoogleUserId("googleUserId");
tune.setTwitterUserId("twitterUserId");
tune.measureEvent(TuneEvent.SHARE);
iOS SDK Share Event
[Tune setUserId:@"US13579"];
[Tune setFacebookUserId:@"321321321321"];
[Tune setGoogleUserId:@"11223344556677"];
[Tune setTwitterUserId:@"1357924680"];
[Tune measureEventName:TUNE_EVENT_SHARE];
Javascript SDK Share Event
MobileAppTracker.setUserId("userId");
MobileAppTracker.setFacebookUserId("facebookUserId");
MobileAppTracker.setGoogleUserId("googleUserId");
MobileAppTracker.setTwitterUserId("twitterUserId");
MobileAppTracker.measureAction({"eventName": "share"});
Windows SDK Share Event
mobileAppTracker.SetUserId("userId");
mobileAppTracker.SetFacebookUserId("facebookUserId");
mobileAppTracker.SetGoogleUserId("googleUserId");
mobileAppTracker.SetTwitterUserId("twitterUserId");
mobileAppTracker.MeasureAction("share");
Adobe Air Plugin Share Event
Tune.instance.setUserId("userId");
Tune.instance.setFacebookUserId("facebookUserId");
Tune.instance.setGoogleUserId("googleUserId");
Tune.instance.setTwitterUserId("twitterUserId");
Tune.instance.measureEventName("share");
Cocos2dx Plugin Share Event
sdkbox::PluginTune::setUserId("userId");
sdkbox::PluginTune::setFacebookUserId("facebookUserId");
sdkbox::PluginTune::setGoogleUserId("googleUserId");
sdkbox::PluginTune::setTwitterUserId("twitterUserId");
sdkbox::PluginTune::measureEventName("share");
PhoneGap Plugin Share Event
window.plugins.tunePlugin.setUserId("userId");
window.plugins.tunePlugin.setFacebookUserId("facebookUserId");
window.plugins.tunePlugin.setGoogleUserId("googleUserId");
window.plugins.tunePlugin.setTwitterUserId("twitterUserId");
window.plugins.tunePlugin.measureEvent("share");
Unity Plugin Share Event
using TuneSDK;
Tune.SetUserId("userId");
Tune.SetFacebookUserId("facebookUserId");
Tune.SetGoogleUserId("googleUserId");
Tune.SetTwitterUserId("twitterUserId");
Tune.MeasureEvent("share");
Xamarin Plugin Share Event
Android
using TuneSDK;
Tune.Instance.SetUserId("userId");
Tune.Instance.SetFacebookUserId("facebookUserId");
Tune.Instance.SetGoogleUserId("googleUserId");
Tune.Instance.SetTwitterUserId("twitterUserId");
Tune.Instance.MeasureEvent(TuneEvent.Share);
iOS
using TuneSDK;
Tune.SetUserId ("userId");
Tune.SetFacebookUserId ("facebookId");
Tune.SetGoogleUserId ("googleId");
Tune.SetTwitterUserId ("twitterId");
Tune.MeasureEventName ("share");
Spent Credits
Include the following values when logging the Credits Spent event:
- User ID (recommended)
- Facebook User ID (recommended if authentication with Facebook)
- Twitter User ID (recommended if authentication with Twitter)
- Google User ID (recommended if authentication with Google)
- Credits Spent set with Quantity (recommended)
Android SDK Spent Credits Event
ITune tune = Tune.getInstance();
tune.setUserId("userId");
tune.setFacebookUserId("facebookUserId");
tune.setGoogleUserId("googleUserId");
tune.setTwitterUserId("twitterUserId");
tune.measureEvent(new TuneEvent(TuneEvent.SPENT_CREDITS).withQuantity(500));
iOS SDK Spent Credits Event
[Tune setUserId:@"US13579"];
[Tune setFacebookUserId:@"321321321321"];
[Tune setGoogleUserId:@"11223344556677"];
[Tune setTwitterUserId:@"1357924680"];
TuneEvent *event = [TuneEvent eventWithName:TUNE_EVENT_SPENT_CREDITS];
event.quantity = 5;
[Tune measureEvent:event];
Javascript SDK Spent Credits Event
MobileAppTracker.setUserId("userId");
MobileAppTracker.setFacebookUserId("facebookUserId");
MobileAppTracker.setGoogleUserId("googleUserId");
MobileAppTracker.setTwitterUserId("twitterUserId");
MobileAppTracker.setEventQuantity(500);
MobileAppTracker.measureAction({"eventName": "spent_credits"});
Windows SDK Spent Credits Event
mobileAppTracker.SetUserId("userId");
mobileAppTracker.SetFacebookUserId("facebookUserId");
mobileAppTracker.SetGoogleUserId("googleUserId");
mobileAppTracker.SetTwitterUserId("twitterUserId");
mobileAppTracker.SetEventQuantity(500);
mobileAppTracker.MeasureAction("spent_credits");
Adobe Air Plugin Spent Credits Event
Tune.instance.setUserId("userId");
Tune.instance.setFacebookUserId("facebookUserId");
Tune.instance.setGoogleUserId("googleUserId");
Tune.instance.setTwitterUserId("twitterUserId");
var tuneEvent:Dictionary = new Dictionary();
tuneEvent.name = "spent_credits";
tuneEvent.quantity = 500;
Tune.instance.measureEvent(tuneEvent);
Cocos2dx Plugin Spent Credits Event
sdkbox::PluginTune::setUserId("userId");
sdkbox::PluginTune::setFacebookUserId("facebookUserId");
sdkbox::PluginTune::setGoogleUserId("googleUserId");
sdkbox::PluginTune::setTwitterUserId("twitterUserId");
TuneEvent event;
event.eventName = "spent_credits";
event.quantity = 500;
sdkbox::PluginTune::measureEvent(event);
PhoneGap Plugin Spent Credits Event
window.plugins.tunePlugin.setUserId("userId");
window.plugins.tunePlugin.setFacebookUserId("facebookUserId");
window.plugins.tunePlugin.setGoogleUserId("googleUserId");
window.plugins.tunePlugin.setTwitterUserId("twitterUserId");
var tuneEvent = {
"name": "spent_credits",
"quantity": 500
};
window.plugins.tunePlugin.measureEvent(tuneEvent);
Unity Plugin Spent Credits Event
using TuneSDK;
Tune.SetUserId("userId");
Tune.SetFacebookUserId("facebookUserId");
Tune.SetGoogleUserId("googleUserId");
Tune.SetTwitterUserId("twitterUserId");
TuneEvent tuneEvent = new TuneEvent("spent_credits");
tuneEvent.quantity = 500;
Tune.MeasureEvent(tuneEvent);
Xamarin Plugin Spent Credits Event
Android
using TuneSDK;
Tune.Instance.SetUserId("userId");
Tune.Instance.SetFacebookUserId("facebookUserId");
Tune.Instance.SetGoogleUserId("googleUserId");
Tune.Instance.SetTwitterUserId("twitterUserId");
Tune.Instance.MeasureEvent(new TuneEvent(TuneEvent.SpentCredits).WithQuantity(500));
iOS
using TuneSDK;
Tune.SetUserId ("userId");
Tune.SetFacebookUserId ("facebookId");
Tune.SetGoogleUserId ("googleId");
Tune.SetTwitterUserId ("twitterId");
TuneEvent evt = TuneEvent.EventWithName ("spent_credits");
evt.Quantity = creditsSpent;
Tune.MeasureEvent (evt);
Tutorial Complete
After a user completes registration, most apps offer a tutorial to show the user how the app works. You can use this event to help assess the quality of users from an advertising partner. An advertising partner who generates installs that result in only a few tutorial completions likely has lower-quality users (because users who do not complete the tutorial have less intent to actually use the app on a repeated basis). Since this "tutorial complete" event usually occurs after registration, you need to duplicate the passing of all the additional user parameters.
- User ID (recommended)
- Facebook User ID (recommended if authentication with Facebook)
- Twitter User ID (recommended if authentication with Twitter)
- Google User ID (recommended if authentication with Google)
Android SDK Tutorial Complete Event
ITune tune = Tune.getInstance();
tune.setUserId("userId");
tune.setFacebookUserId("facebookUserId");
tune.setGoogleUserId("googleUserId");
tune.setTwitterUserId("twitterUserId");
tune.measureEvent(TuneEvent.TUTORIAL_COMPLETE);
iOS SDK Tutorial Complete Event
[Tune setUserId:@"US13579"];
[Tune setFacebookUserId:@"321321321321"];
[Tune setGoogleUserId:@"11223344556677"];
[Tune setTwitterUserId:@"1357924680"];
[Tune measureEventName:TUNE_EVENT_TUTORIAL_COMPLETE];
Javascript SDK Tutorial Complete Event
MobileAppTracker.setUserId("userId");
MobileAppTracker.setFacebookUserId("facebookUserId");
MobileAppTracker.setGoogleUserId("googleUserId");
MobileAppTracker.setTwitterUserId("twitterUserId");
MobileAppTracker.measureAction({"eventName": "tutorial_complete"});
Windows SDK Tutorial Complete Event
mobileAppTracker.SetUserId("userId");
mobileAppTracker.SetFacebookUserId("facebookUserId");
mobileAppTracker.SetGoogleUserId("googleUserId");
mobileAppTracker.SetTwitterUserId("twitterUserId");
mobileAppTracker.MeasureAction("tutorial_complete");
Adobe Air Plugin Tutorial Complete Event
Tune.instance.setUserId("userId");
Tune.instance.setFacebookUserId("facebookUserId");
Tune.instance.setGoogleUserId("googleUserId");
Tune.instance.setTwitterUserId("twitterUserId");
Tune.instance.measureEventName("tutorial_complete");
Cocos2dx Plugin Tutorial Complete Event
sdkbox::PluginTune::setUserId("userId");
sdkbox::PluginTune::setFacebookUserId("facebookUserId");
sdkbox::PluginTune::setGoogleUserId("googleUserId");
sdkbox::PluginTune::setTwitterUserId("twitterUserId");
sdkbox::PluginTune::measureEventName("tutorial_complete");
PhoneGap Plugin Tutorial Complete Event
window.plugins.tunePlugin.setUserId("userId");
window.plugins.tunePlugin.setFacebookUserId("facebookUserId");
window.plugins.tunePlugin.setGoogleUserId("googleUserId");
window.plugins.tunePlugin.setTwitterUserId("twitterUserId");
window.plugins.tunePlugin.measureEvent("tutorial_complete");
Unity Plugin Tutorial Complete Event
using TuneSDK;
Tune.SetUserId("userId");
Tune.SetFacebookUserId("facebookUserId");
Tune.SetGoogleUserId("googleUserId");
Tune.SetTwitterUserId("twitterUserId");
Tune.MeasureEvent("tutorial_complete");
Xamarin Plugin Tutorial Complete Event
Android
using TuneSDK;
Tune.Instance.SetUserId("userId");
Tune.Instance.SetFacebookUserId("facebookUserId");
Tune.Instance.SetGoogleUserId("googleUserId");
Tune.Instance.SetTwitterUserId("twitterUserId");
Tune.Instance.MeasureEvent(TuneEvent.TutorialComplete);
iOS
using TuneSDK;
Tune.SetUserId ("userId");
Tune.SetFacebookUserId ("facebookId");
Tune.SetGoogleUserId ("googleId");
Tune.SetTwitterUserId ("twitterId");
Tune.MeasureEventName ("tutorial_complete");
Advanced Event Functionality
Difference Between Event ID and Reference ID
Our SDKs provide several overloaded methods to measure in-app events. Some of the methods allow you to enter the Event ID and Reference ID, which serve different purposes in the method and should not be confused (to ensure proper functioning). This page describes how you can use each of these IDs.
Event Id
When measuring an event from the SDK, you can choose to measure either a pre-defined event or a dynamically created event. To measure a pre-defined event, simply use the TUNE Event ID for the event. To measure a dynamically created event, use its name (for example, "HighScoresPageViewed"). If an event by this name does not exist, then MAT automatically creates one.
To manage pre-defined events, log in to the Branch dashboard, go to the Mobile Apps tab, and select an app. There you can view existing Event Ids in the Events List or create a new event by clicking Add Event.
Only the Event IDs listed in the Event ID column (of the Events List table) may be used for corresponding pre-defined events. If you use any other value, then Attribution Analytics treats it as a dynamic event name.
Reference ID
When measuring an event from the SDK, you can optionally include a unique Reference Id that might match your internal system. These unique Reference Ids can serve two purposes: to reconcile with your internal system, and to make sure that Attribution Analytics does not ignore the event as a duplicate.
Normally, Attribution Analytics ignores duplicate events received during a specified time period after the first event. If you want to measure multiple events with the same name or Event Id during the Block Duplicate Length setting, then you can assign unique Reference Ids to the events to indicate to Attribution Analytics that these events are unique.
Android SDK Setup
On Android, a number of overloaded measureAction
methods allow you to include the parameters you want to record with the event measuring request.
TuneEvent event = new TuneEvent(12345678);
event.withAdvertiserRefId("RJ1357");
Tune tune = Tune.getInstance();
tune.measureEvent(event);
iOS SDK Setup
On iOS, a number of overloaded measureAction
and measureActionWithEventId:
methods allow you to include the parameters you want to record with the event measuring request.
+ (void)measureEventId:(NSInteger)eventId;
TuneEvent *event = [TuneEvent eventWithId:1122334455];
event.refId = @"RJ1357";
[Tune measureEvent:event];
Event Builder
With the extensive options that Attribution Analytics (AA) provides for event measurement, it can be overwhelming to know which events to measure and how to actually measure them in your code.
Starting from the TUNE Android SDK version 3.8, iOS SDK 3.9 and compatible plugins, we’re introducing the TuneEvent class to simplify the way you build event measurement calls.
Android SDK
Event Builder Characteristics
参数 | 类型 | 描述 |
---|---|---|
Event 名称 | String | Name of event to measure, e.g. "purchase" |
Revenue | Double | Revenue of event to measure |
货币代码 | String | ISO 4217 currency code of revenue |
广告主参考 ID | String | Unique reference ID (like an order ID) to associate with the event |
事件项目 | 清单 | List of Tune Event Items |
Receipt Data | String | iTunes receipt or Google Play receipt data, for purchase validation |
Receipt Signature | String | Google Play receipt signature, for purchase validation |
内容 ID | String | International Article Number (EAN) when applicable, or other product or content identifier |
Content Type | String | Content type, e.g. "shoes" |
Date 1 | Date | Date of an event |
Date 2 | Date | Second date of an event, e.g. an end date |
Level | Integer | Level of an event |
Quantity | Integer | Quantity for an event |
评级 | Double | Rating for an event |
搜索 String | String | Search string for an event |
Attribute 1-5 | String | Arbitrary String values of your choice to associate with an event |
Building an Event
基础
When constructing an event, only the eventName is required. If these are the only values you care about measuring, you do not need to use the event builder (simply use measureEvent directly with your eventName):
measureEvent(String eventName);
高级
For more complex events, we’ll use measureEvent with the TuneEvent parameter. We first instantiate a new TuneEvent object with a required eventName.
Tune.getInstance().measureEvent(new TuneEvent("purchase"));
You may then set any additional parameters to this TuneEvent. A full list of parameters can be found below. You may add new parameters you discover onto an existing TuneEvent object to update it, as long as it is built before the measureEvent call.
For example, to measure revenue and currency code with a "purchase" event:
Tune.getInstance().measureEvent(new TuneEvent("purchase").withRevenue(0.99).withCurrencyCode("CAD"));
You may add as many applicable parameters as you like:
Tune.getInstance().measureEvent(new TuneEvent("purchase")
.withRevenue(0.99)
.withCurrencyCode("CAD")
.withAdvertiserRefId("12345")
.withLevel(5)
.withAttribute1("extra life"));
Builder Event Items
Event Items have a similar builder helper, here we have an example of its use in conjunction with TuneEvent:
// Add TuneEventItem to a List to pass into TuneEvent
ArrayList<TuneEventItem> list = new ArrayList<>();
list.add(new TuneEventItem("apple")
.withQuantity(3));
Tune.getInstance().measureEvent(new TuneEvent("purchase")
.withEventItems(list));
Builder Methods
List of parameters that can be linked with a TuneEvent:
withAdvertiserRefId(String advertiserRefId)
withAttribute1(String attribute)
withAttribute2(String attribute)
withAttribute3(String attribute)
withAttribute4(String attribute)
withAttribute5(String attribute)
withContentId(String contentId)
withContentType(String contentType)
withCurrencyCode(String currencyCode)
withDate1(Date date1)
withDate2(Date date2)
withEventItems(List<TuneEventItem> eventItems)
withLevel(int level)
withQuantity(int quantity)
withRating(double rating)
withReceipt(String receiptData, String receiptSignature)
withRevenue(double revenue)
withSearchString(String searchString)
For event templates and sample code, please visit Event Function Templates.
iOS SDK
Event Builder Characteristics
参数 | 类型 | 描述 |
---|---|---|
Event 名称 | NSString | Name of event to measure, e.g. "purchase" |
Revenue | CGFloat | Revenue of event to measure |
货币代码 | NSString | ISO 4217 currency code of revenue |
广告主参考 ID | NSString | Unique reference ID (like an order ID) to associate with the event |
事件项目 | 清单 | List of Tune Event Items |
Receipt Data | NSData | iTunes receipt receipt data, for purchase validation |
内容 ID | NSString | International Article Number (EAN) when applicable, or other product or content identifier |
Content Type | NSString | Content type, e.g. "shoes" |
Date 1 | NSDate | Date of an event |
Date 2 | NSDate | Second date of an event, e.g. an end date |
Level | NSInteger | Level of an event |
Quantity | NSInteger | Quantity for an event |
评级 | CGFloat | Rating for an event |
搜索 String | NSString | Search string for an event |
Attribute 1-5 | NSString | Arbitrary String values of your choice to associate with an event |
Building an Event
基础
When constructing an event, only the eventName is required. If these are the only values you care about measuring, you do not need to use the event builder (simply use measureEvent directly with your eventName):
+ (void)measureEventName:(NSString *)eventName;
高级
For more complex events, we’ll use measureEvent with the TuneEvent parameter. We first instantiate a new TuneEvent object with a required eventName.
TuneEvent *event = [TuneEvent eventWithName:@"purchase"];
[Tune measureEvent:event];
You may then set any additional parameters to this TuneEvent. A full list of parameters can be found below. You may add new parameters you discover onto an existing TuneEvent object to update it, as long as it is built before the measureEvent call.
For example, to measure revenue and currency code with a "purchase" event:
TuneEvent *event = [TuneEvent eventWithName:@"purchase"];
event.revenue = 0.99;
event.currencyCode = @"CAD";
[Tune measureEvent:event];
You may add as many applicable parameters as you like:
TuneEvent *event = [TuneEvent eventWithName:@"purchase"];
event.revenue = 0.99;
event.currencyCode = @"CAD";
event.refId = @"12345";
event.level = 5;
event.attribute1 = @"extra life";
[Tune measureEvent:event];
Builder Event Items
Event Items have a similar builder helper, here we have an example of its use in conjunction with TuneEvent:
TuneEventItem *item = [TuneEventItem eventItemWithName:@"apple" unitPrice:0.49 quantity:3];
TuneEvent *event = [TuneEvent eventWithName:@"purchase"];
event.eventItems = @[item];
[Tune measureEvent:event];
Builder Methods
List of parameters that can be linked with a TuneEvent:
NSString *eventName; // readonly
NSInteger eventId;
NSArray *eventItems;
CGFloat revenue;
NSString *currencyCode;
NSString *refId;
NSData *receipt;
NSString *contentType;
NSString *contentId;
NSString *searchString;
NSInteger transactionState;
CGFloat rating;
NSInteger level;
NSUInteger quantity;
NSDate *date1;
NSDate *date2;
NSString *attribute1;
NSString *attribute2;
NSString *attribute3;
NSString *attribute4;
NSString *attribute5;
For event templates and sample code, please visit Event Function Templates.
PhoneGap Plugin
Event Builder Characteristics
参数 | 类型 | 描述 |
---|---|---|
Event 名称 | String | Name of event to measure, e.g. "purchase" |
Revenue | Double | Revenue of event to measure |
货币代码 | String | ISO 4217 currency code of revenue |
广告主参考 ID | String | Unique reference ID (like an order ID) to associate with the event |
事件项目 | 清单 | List of Tune Event Items |
Receipt Data | String | iTunes receipt or Google Play receipt data, for purchase validation |
Receipt Signature | String | Google Play receipt signature, for [purchase validation](doc:advanced-topics#in-app-purchase-verification |
内容 ID | String | International Article Number (EAN) when applicable, or other product or content identifier |
Content Type | String | Content type, e.g. "shoes" |
Date 1 | Date | Date of an event |
Date 2 | Date | Second date of an event, e.g. an end date |
Level | Integer | Level of an event |
Quantity | Integer | Quantity for an event |
评级 | Double | Rating for an event |
搜索 String | String | Search string for an event |
Attribute 1-5 | String | Arbitrary String values of your choice to associate with an event |
Building an Event
基础
When constructing an event, only the eventName is required. If these are the only values you care about measuring, you do not need to use the event builder (simply use measureEvent directly with your eventName):
measureEvent(string eventName);
高级
For more complex events, we’ll use measureEvent with the TuneEvent parameter. We first instantiate a new TuneEvent object with a required eventName.
var tuneEvent = {"name": "purchase"};
window.plugins.tunePlugin.measureEvent(matEvent);
You may then set any additional parameters to this TuneEvent. A full list of parameters can be found below. You may add new parameters you discover onto an existing TuneEvent object to update it, as long as it is built before the measureEvent call.
For example, to measure revenue and currency code with a "purchase" event:
var tuneEvent = {
"name": "purchase",
"revenue": 0.99,
"currency": "CAD"
};
window.plugins.tunePlugin.measureEvent(matEvent);
You may add as many applicable parameters as you like:
var tuneEvent = {
"name": "purchase",
"revenue": 0.99,
"currency": "CAD",
"advertiserRefId": "12345",
"level": 5,
"attribute1": "extra life"
};
window.plugins.tunePlugin.measureEvent(tuneEvent);
Builder Event Items
Event Items have a similar builder helper, here we have an example of its use in conjunction with TuneEvent:
// Add TUNE Event Item to an Array to pass into the TuneEvent
var eventItems = new Array();
var eventItem = {
"item": "apple",
"quantity": 3
};
eventItems[0] = eventItem;
var tuneEvent = {
"name": "purchase",
"eventItems": eventItems
};
window.plugins.tunePlugin.measureEvent(tuneEvent);
Builder Methods
List of parameters that can be linked with a TuneEvent:
string name;
number id;
double revenue;
string currency;
string advertiserRefId;
var[] eventItems;
string receipt;
string receiptSignature;
string contentType;
string contentId;
int level;
int quantity;
string searchString;
double rating;
double date1;
double date2;
string attribute1;
string attribute2;
string attribute3;
string attribute4;
string attribute5;
For event templates and sample code, please visit Event Function Templates.
Titanium Plugin
Event Builder Characteristics
参数 | 类型 | 描述 |
---|---|---|
Event 名称 | String | Name of event to measure, e.g. "purchase" |
Revenue | Double | Revenue of event to measure |
货币代码 | String | ISO 4217 currency code of revenue |
广告主参考 ID | String | Unique reference ID (like an order ID) to associate with the event |
事件项目 | 清单 | List of Tune Event Items |
Receipt Data | String | iTunes receipt or Google Play receipt data, for purchase validation |
Receipt Signature | String | Google Play receipt signature, for purchase validation |
内容 ID | String | International Article Number (EAN) when applicable, or other product or content identifier |
Content Type | String | Content type, e.g. "shoes" |
Date 1 | Date | Date of an event |
Date 2 | Date | Second date of an event, e.g. an end date |
Level | Integer | Level of an event |
Quantity | Integer | Quantity for an event |
评级 | Double | Rating for an event |
搜索 String | String | Search string for an event |
Attribute 1-5 | String | Arbitrary String values of your choice to associate with an event |
Building an Event
基础
When constructing an event, only the eventName is required. If these are the only values you care about measuring, you do not need to use the event builder (simply use measureEvent directly with your eventName):
measureEvent(string eventName);
高级
For more complex events, we’ll use measureEvent with the TuneEvent parameter. We first instantiate a new TuneEvent object with a required eventName.
var matEvent = {eventName: "purchase"};
mobileAppTracker.measureEvent(matEvent);
You may then set any additional parameters to this TuneEvent. A full list of parameters can be found below. You may add new parameters you discover onto an existing TuneEvent object to update it, as long as it is built before the measureEvent call.
For example, to measure revenue and currency code with a "purchase" event:
var matEvent = {
eventName: "purchase",
revenue: 0.99,
currencyCode: "CAD"
};
mobileAppTracker.measureEvent(matEvent);
You may add as many applicable parameters as you like:
var matEvent = {
eventName: "purchase",
revenue: 0.99,
currencyCode: "CAD",
advertiserRefId: "12345",
level: 5,
attribute1: "extra life"
};
mobileAppTracker.measureEvent(matEvent);
Builder Event Items
Event Items have a similar builder helper, here we have an example of its use in conjunction with TuneEvent:
// Add MAT Event Item to an Array to pass into the MATEvent
var eventItems = new Array();
var eventItem = {
"item": "apple",
"quantity": 3
};
eventItems[0] = eventItem;
var matEvent = {
eventName: "purchase",
eventItems: eventItems
};
mobileAppTracker.measureEvent(matEvent);
Builder Methods
List of parameters that can be linked with a TuneEvent:
string eventName;
number id;
double revenue;
string currencyCode;
string advertiserRefId;
var[] eventItems;
string receipt;
string receiptSignature;
string contentType;
string contentId;
int level;
int quantity;
string searchString;
double rating;
double date1;
double date2;
string attribute1;
string attribute2;
string attribute3;
string attribute4;
string attribute5;
For event templates and sample code, please visit Event Function Templates.
Unity Plugin
Event Builder Characteristics
参数 | 类型 | 描述 |
---|---|---|
Event 名称 | String | Name of event to measure, e.g. "purchase" |
Revenue | Double | Revenue of event to measure |
货币代码 | String | ISO 4217 currency code of revenue |
广告主参考 ID | String | Unique reference ID (like an order ID) to associate with the event |
事件项目 | 清单 | List of Tune Event Items |
Receipt Data | String | iTunes receipt or Google Play receipt data, for purchase validation |
Receipt Signature | String | Google Play receipt signature, for purchase validation |
内容 ID | String | International Article Number (EAN) when applicable, or other product or content identifier |
Content Type | String | Content type, e.g. "shoes" |
Date 1 | Date | Date of an event |
Date 2 | Date | Second date of an event, e.g. an end date |
Level | Integer | Level of an event |
Quantity | Integer | Quantity for an event |
评级 | Double | Rating for an event |
搜索 String | String | Search string for an event |
Attribute 1-5 | String | Arbitrary String values of your choice to associate with an event |
Building an Event
基础
When constructing an event, only the eventName is required. If these are the only values you care about measuring, you do not need to use the event builder (simply use measureEvent directly with your eventName):
Tune.MeasureEvent(string eventName);
高级
For more complex events, we’ll use measureEvent with the TuneEvent parameter. We first instantiate a new TuneEvent object with a required eventName.
Tune.MeasureEvent(new TuneEvent("purchase"));
You may then set any additional parameters to this TuneEvent. A full list of parameters can be found below. You may add new parameters you discover onto an existing TuneEvent object to update it, as long as it is built before the measureEvent call.
For example, to measure revenue and currency code with a "purchase" event:
TuneEvent event = new TuneEvent("purchase");
event.revenue = 0.99;
event.currencyCode = "CAD";
Tune.MeasureEvent(event);
You may add as many applicable parameters as you like:
TuneEvent event = new TuneEvent("purchase");
event.revenue = 0.99;
event.currencyCode = "CAD";
event.advertiserRefId = "12345";
event.level = 5;
event.attribute1 = "extra life";
Tune.MeasureEvent(event);
Builder Event Items
Event Items have a similar builder helper, here we have an example of its use in conjunction with TuneEvent:
// Add TuneItem to an Array to pass into TuneEvent
TuneItem item = new TuneItem("apple");
item.quantity = 3;
TuneItem[] eventItems = {item};
TuneEvent tuneEvent = new TuneEvent("purchase");
tuneEvent.eventItems = eventItems;
Tune.MeasureEvent(tuneEvent);
Builder Methods
List of parameters that can be linked with a TuneEvent:
string name;
int? id;
double? revenue;
string currencyCode;
string advertiserRefId;
TuneItem[] eventItems;
int transactionState;
string receipt;
string receiptSignature;
string contentType;
string contentId;
int? level;
int? quantity;
string searchString;
double? rating;
DateTime? date1;
DateTime? date2;
string attribute1;
string attribute2;
string attribute3;
string attribute4;
string attribute5;
For event templates and sample code, please visit Event Function Templates.
Event Function Templates
The measureEvent
method is designed to measure in-app user actions and allows you to define the event name dynamically, as well as use specific events that Attribution Analytics (AA) supports natively. If you have a particular event that you want to start measuring, then call measureEvent
with the event name set to whatever type of event you are logging (for example, "registration" or "purchase").
After you log these events, you can find them in AA by viewing Reports > Logs > Events. Then you can filter the report by the event that you specified in the measureEvent
call.
注意
Before calling the
measureEvent
method, use the parameters forgender
,age
, anduser_id
(plus,fb_user_id
,twitter_user_id
,google_user_id
, etc.) so they can be associated with all of the events that you’re measuring. You only need to do so once with each app release, not before eachmeasureAction/measureEvent
call.See Custom Settings for more information.
We have provided function templates for each platform/plugin below, showing the various invocations and argument options for each. You can insert the appropriate arguments based on the event that you want to log. The measureEvent
function allows you to define events dynamically using the following arguments:
Android SDK Event Functions
Tune.getInstance().measureEvent(String eventName);
Tune.getInstance().measureEvent(TuneEvent matEvent);
iOS SDK Event Functions
+ (void)measureEventName:(NSString *)eventName;
+ (void)measureEvent:(TuneEvent *)event;
Javascript SDK Event Functions
MobileAppTracker.measureAction({"eventName": eventName,
"revenue": revenue,
"currencyCode": currencyCode,
"referenceId": referenceId,
"eventItems": eventItems,
"cb": callback});
MobileAppTracker.measureAction({"eventName": eventName,
"revenue": revenue,
"currencyCode": currencyCode,
"referenceId": referenceId,
"eventItems": eventItems},
callback);
Windows SDK Event Functions
mobileAppTracker.MeasureAction(eventName, revenue, currencyCode, referenceId, eventItems);
Adobe Air Plugin Event Functions
mobileAppTracker.measureAction(eventName, revenue, currencyCode, referenceId);
mobileAppTracker.measureActionWithEventItem(eventName, eventItems, revenue, currencyCode,
referenceId, transactionState, receiptData, receiptSignature);
Cocos2dx Plugin Event Functions
pluginMat-&callFuncWithParam("measureAction", &EventName, NULL);
pluginMat-&callFuncWithParam("measureActionWithRefId", &pEventName, &pReferenceId, NULL);
pluginMat-&callFuncWithParam("measureActionWithRevenue", &pEventName, &pReferenceId, &pRevenue, &pCurrencyCode, NULL);
pluginMat-&callFuncWithParam("measureActionWithEventItems", &pEventName, &pReferenceId, &Revenue, &CurrencyCode,
&pEventItem1, &pEventItem2, NULL);
pluginMat-&callFuncWithParam("measureActionWithIAPReceipt", &pEventName, &pReferenceId, &pRevenue, &pCurrencyCode,
&pTransactionState, &pReceiptData, &pReceiptSignature, &pEventItem1, &pEventItem2, NULL);
PhoneGap Plugin Event Functions
mobileAppTracker.measureEvent(eventName);
mobileAppTracker.measureEvent(eventId);
mobileAppTracker.measureEvent(matEvent);
Titanium Plugin Event Functions
mobileAppTracker.measureEventName(eventName);
mobileAppTracker.measureEvent(matEvent);
Unity Plugin Event Functions
Tune.MeasureEvent(string eventName);
Tune.MeasureEvent (new TuneEvent (string eventName));
Xamarin Plugin Event Functions
Android
Tune.getInstance().measureEvent(String eventName);
Tune.getInstance().measureEvent(TuneEvent matEvent);
iOS
TuneEvent tuneEvent = TuneEvent.EventWithName ("Sample Event Name");
Tune.MeasureEvent(tuneEvent);
Tune.MeasureEventName ("Sample Event Name");
事件项目
While an event is like a purchase receipt, the event items in Attribution Analytics are the individual items purchased. Event items allow you to define multiple items for a single logging event. For example, if you go to the supermarket and buy 1 apple and 2 oranges, then these fruits are the event items for the single event (of the supermarket purchase).
While you can log server-side, this article describes how to include event items with logged events using the SDK (which is useful for logging various purchases and information about individual purchase events such as rooms booked, travel purchased, or virtual goods collected).
The event items allow you to include up to 5 custom string attributes. The max allowed length for these custom attributes is 255 characters.
To start logging event items for your mobile app, follow the information below. TUNE provides a function template for each platform/plugin below. You can then insert the appropriate arguments based on the event items that you want to log.
Event Item Characteristics
参数 | 类型 | 描述 |
---|---|---|
itemName | String | The name of the item. |
unitPrice | Double | Individual price of one unit of the item. |
quantity | Integer | Number of items purchased. |
revenue | Double | Total value of the purchase (overrides quantity x unitPrice if non-zero). |
attribute1 | String | Custom string for your optional use (max allowed length is 255 characters). |
attribute2 | String | Custom string for your optional use (max allowed length is 255 characters). |
attribute3 | String | Custom string for your optional use (max allowed length is 255 characters). |
attribute4 | String | Custom string for your optional use (max allowed length is 255 characters). |
attribute5 | String | Custom string for your optional use (max allowed length is 255 characters). |
Android SDK Event Items
TuneEventItem eventItem = new TuneEventItem(itemName) // Required
.withQuantity(quantity) // Rest are optional
.withUnitPrice(unitPrice)
.withRevenue(revenue)
.withAttribute1(attribute)
...
.withAttribute5(attribute);
例如
// Example event item with product SKU
TuneEventItem eventItem = new TuneEventItem("apple")
.withQuantity(3)
.withUnitPrice(0.50)
.withRevenue(1.50)
.withAttribute1("3848-4578458-347834");
iOS SDK Event Items
TuneEventItem *eventItem;
eventItem = [TuneEventItem eventItemWithName:itemName unitPrice:unitPrice quantity:quantity];
eventItem = [TuneEventItem eventItemWithName:itemName unitPrice:unitPrice quantity:quantity revenue:revenue];
eventItem = [TuneEventItem eventItemWithName:itemName
attribute1:attribute1
attribute2:attribute2
attribute3:attribute3
attribute4:attribute4
attribute5:attribute5];
eventItem = [TuneEventItem eventItemWithName:itemName
unitPrice:unitPrice
quantity:quantity
revenue:revenue
attribute1:attribute1
attribute2:attribute2
attribute3:attribute3
attribute4:attribute4
attribute5:attribute5];
例如
// Example event item with product SKU
TuneEventItem *eventItem = [TuneEventItem eventItemWithName:@"apple"
unitPrice:0.50
quantity:3
revenue:1.50
attribute1:@"3848-4578458-347834"
attribute2:@"crisp"
attribute3:@"red"
attribute4:nil
attribute5:nil];
Javascript SDK Event Items
var eventItem = new MobileAppTracker.MATEventItem({
"item": itemName,
"unit_price": unitPrice,
"quantity": quantity,
"revenue": revenue,
"attribute_sub1": attribute1,
"attribute_sub2": attribute2,
"attribute_sub3": attribute3,
"attribute_sub4": attribute4,
"attribute_sub5": attribute5
});
MobileAppTracker.measureAction({"eventName": eventName, "eventItems": [eventItem]});
例如
// Example event item with product SKU
var eventItem = new MobileAppTracker.MATEventItem({
"item": "apple",
"unit_price": 0.50,
"quantity": 3,
"revenue": 1.50,
"attribute_sub1": "3848-4578458-347834"
};
Windows SDK Event Items
MATEventItem eventItem = new MATEventItem (itemName, quantity, unitPrice, revenue,
attribute1, attribute2, attribute3, attribute4, attribute5);
List<MATEventItem> eventItems = new List<MATEventItem>();
eventItems.add (eventItem);
mobileAppTracker.TrackAction (eventName, 0, null, null, eventItems);
例如
// Example event item with product SKU
MATEventItem eventItem = new MATEventItem ("apple", 3, 0.50, 1.50,
"3848-4578458-347834", null, null, null, null);
List<MATEventItem> eventItems = new List<MATEventItem>();
eventItems.add (eventItem);
Adobe Air Plugin Event Items
var eventItem:Dictionary = new Dictionary();
eventItem["item"] = itemName;
eventItem["unit_price"] = unitPrice;
eventItem["quantity"] = quantity;
eventItem["revenue"] = revenue;
eventItem["attribute_sub1"] = attribute1;
eventItem["attribute_sub2"] = attribute2;
eventItem["attribute_sub3"] = attribute3;
eventItem["attribute_sub4"] = attribute4;
eventItem["attribute_sub5"] = attribute5;
var eventItems:Array = new Array();
eventItems.push(eventItem);
mobileAppTracker.measureActionWithEventItem(eventName, eventItems);
Cocos2dx Plugin Event Items
StringMap eventItem;
eventItem["item"] = itemName;
eventItem["unit_price"] = unitPrice;
eventItem["quantity"] = quantity;
eventItem["revenue"] = revenue;
eventItem["attribute1"] = attribute1;
eventItem["attribute2"] = attribute2;
eventItem["attribute3"] = attribute3;
eventItem["attribute4"] = attribute4;
eventItem["attribute5"] = attribute5;
PluginParam pEventItem(eventItem);
pluginMat->callFuncWithParam("trackActionWithEventItems", &pEventName, &pReferenceId, &pRevenue, &pCurrencyCode,
&pEventItem, NULL);
例如
// Example event item with product SKU
StringMap eventItem;
eventItem["item"] = "apple";
eventItem["unit_price"] = 0.50f;
eventItem["quantity"] = 3;
eventItem["revenue"] = 1.50f;
eventItem["attribute1"] = "3848-4578458-347834";
PluginParam pEventItem(eventItem);
PhoneGap Plugin Event Items
var eventItems = new Array();
var eventItem = {
"item": itemName,
"unit_price": unitPrice,
"quantity": quantity,
"revenue": revenue,
"attribute_sub1": attribute1,
"attribute_sub2": attribute2,
"attribute_sub3": attribute3,
"attribute_sub4": attribute4,
"attribute_sub5": attribute5
};
eventItems[0] = eventItem;
var tuneEvent = {
"name": "eventName",
"eventItems": eventItems
};
window.plugins.tunePlugin.measureEvent(tuneEvent);
例如
var eventItems = new Array();
// Example event item with product SKU
var eventItem = {
"item": "apple",
"unit_price": 0.50,
"quantity": 3,
"revenue": 1.50,
"attribute_sub1": "3848-4578458-347834"
};
eventItems[0] = eventItem;
var tuneEvent = {
"name": "purchase",
"eventItems": eventItems
};
window.plugins.tunePlugin.measureEvent(tuneEvent);
Titanium Plugin Event Items
var eventItem = {"item": itemName,
"unit_price": unitPrice,
"quantity": quantity,
"revenue": revenue,
"attribute_sub1": attribute1,
"attribute_sub2": attribute2,
"attribute_sub3": attribute3,
"attribute_sub4": attribute4,
"attribute_sub5": attribute5};
mobileAppTracker.measureEvent({
eventName: eventName,
eventItems: [eventItem]
});
例如
// Example event item with product SKU
var eventItem = {"item": "apple",
"unit_price": 0.50,
"quantity": 3,
"revenue": 1.50,
"attribute_sub1": "3848-4578458-347834"
};
mobileAppTracker.measureEvent({
eventName: eventName,
eventItems: [eventItem]
});
Unity Plugin Event Items
using TuneSDK;
TuneItem eventItem = new TuneItem("itemName");
eventItem.unitPrice = unitPrice;
eventItem.quantity = quantity;
eventItem.revenue = revenue;
eventItem.attribute1 = attribute1;
eventItem.attribute2 = attribute2;
eventItem.attribute3 = attribute3;
eventItem.attribute4 = attribute4;
eventItem.attribute5 = attribute5;
Xamarin Plugin Event Items
Android
TuneEventItem eventItem = new TuneEventItem (itemName)
.WithQuantity(quantity)
.WithUnitPrice(unitPrice)
.WithRevenue(revenue)
.WithAttribute1(attribute1)
.WithAttribute2(attribute2)
.WithAttribute3(attribute3)
.WithAttribute4(attribute4)
.WithAttribute5(attribute5);
List<TuneEventItem> list = new List<TuneEventItem>();
list.Add(eventItem);
TuneEvent tuneEvent = new TuneEvent(eventName).WithEventItems(list);
Tune.Instance.MeasureEvent(tuneEvent);
例如
// Example event item with product SKU
TuneEventItem eventItem = new TuneEventItem("apple")
.WithQuantity(3)
.WithUnitPrice(0.50)
.WithRevenue(1.50)
.WithAttribute1("3848-4578458-347834");
iOS
TuneEventItem eventItem = TuneEventItem.EventItemWithName(itemName, unitPrice, quantity, revenue, attribute1, attribute2, attribute3, attribute4, attribute5);
TuneEvent tuneEvent = TuneEvent.EventWithName(eventName);
tuneEvent.EventItems = new TuneEventItem[] { eventItem };
Tune.MeasureEvent(tuneEvent);
例如
// Example event item with product SKU
TuneEventItem eventItem = TuneEventItem.EventItemWithName("apple", 0.50, 3, 1.50, "3848-4578458-347834", "", "", "", "");
Facebook Event Logging
In conjunction with the attribution and logging features provided by Attribution Analytics (AA), you can also log the AA-recorded events to Facebook by integrating the Facebook SDK (along with the TUNE SDK) into your app. The integration of these SDKs allows you to log events in both systems, so you can measure and optimize campaign performance in not only AA, but also Facebook App Insights and Facebook Ads. Please keep in mind that in AA, events attributed to Facebook appear as Organic because Facebook is not a AA-integrated partner.
When you enable Facebook event logging (as described below), AA invokes the Facebook AppEventsLogger class through reflection. Then, events passed in "measureEvent" calls will correspond with the following Facebook events:
AA Event | Facebook Event |
---|---|
registration | 注册 |
content_view | Content View |
search | 搜索 |
rated | 评级 |
tutorial_complete | Tutorials Completed |
添加到购物车 | 添加到购物车 |
ADD_TO_WISHLIST | Add to Wishlist |
checkout_initiated | Initiated Checkout |
added_payment_info | Added Payment Info |
购买 | Purchase |
level_achieved | Levels Achieved |
achievement_unlocked | Achievements Unlocked |
spent_credits | Spent Credits |
Any other event names passed to "measureEvent" get sent in their original form to Facebook Insights.
For event templates, see Event Function Templates.
For more information about the AppEventsLogger class in Facebook, see Facebook Platform AppEventsLogger.
Android
To enable Facebook event logging with AA, make sure that the Facebook SDK is integrated and your Facebook app id is set in res/values/strings.xml:
<string name="facebook_app_id">your_facebook_app_id_here</string>
The "facebook_app_id" value allows the Facebook SDK to find your app id.
Then, add a meta-data tag to your AndroidManifest.xml inside referring to the FB app id string set previously:
<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id"/>
Next, after initializing Tune in your Activity, call "setFacebookEventLogging", passing in "true" to enable logging, the Activity context, and whether the user chose the FB opt-out for ads targeting:
tune = Tune.init(getApplicationContext(), "TUNE_ADVERTISER_ID", "TUNE_CONVERSION_KEY");
tune.setFacebookEventLogging(true, this, limitEventAndDataUsage);
To disable logging, call "setFacebookEventLogging" with "false" instead.
With Facebook event logging enabled, "measureSession" and "measureEvent" calls will trigger the following Facebook events:
- First "measureSession" call on device → App Installs
- Subsequent "measureSession" calls → App Launches
- Events passed in "measureEvent" calls correspond with the Facebook events listed in the table at the top of this page.
iOS
To enable Facebook event logging with AA, make sure that the Facebook SDK is integrated and your FacebookAppId is set in Info.plist of your project. Also make sure that the "Other Linker Flags" build setting contains the "-ObjC" flag.
Next, after initializing Tune in your AppDelegate "application:didFinishLaunchingWithOptions:", call "setFacebookEventLogging:limitEventAndDataUsage:", passing YES as the first parameter (to enable Facebook event logging) and the appropriate value (YES/NO) for "limitEventAndDataUsage" to restrict the data sent to Facebook from being used for purposes other than analytics and conversions.
[Tune initializeWithTuneAdvertiserId:TUNE_ADVERTISER_ID
tuneConversionKey:TUNE_CONVERSION_KEY];
[Tune setFacebookEventLogging:YES limitEventAndDataUsage:NO];
To disable Facebook event logging, call "setFacebookEventLogging:limitEventAndDataUsage:" and pass NO as the first parameter; in this case, the second parameter has no effect.
With Facebook event logging enabled, "measureSession" and "measureEvent" calls will trigger the following Facebook events:
- Calls to AA "measureSession" result in calls to FB "activateApp"
- Events passed in "measureEvent" calls will correspond with the Facebook events listed in the table at the top of this page.
Measuring Events with the TUNE SDK in WebView
Sometimes, your app contains HTML content that you want to measure events on. One approach is to override your WebViewClient and handle the URL loading to find the URL request that corresponds with your event and call the measureEvent
method before it loads.
WebView with Android SDK
The following code shows an example for the Android SDK that gets the WebView object "browser" from the layout and overrides the URL load with a check (to see if the URL ends with "skip"). Then it calls a skip action before completing the request. Modify this example to suit your own requests.
WebView browser = (WebView)findViewById(R.id.browser);
browser.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
if (url.endsWith("skip")) {
tune.measureEventName("skip");
}
return true;
}
});
WebView with iOS SDK
The following code shows an example for the iOS SDK that gets the WebView object "browser" from the layout and overrides the URL load with a check (to see if the URL ends with "skip"). Then it calls a skip action before completing the request. Modify this example to suit your own requests.
(BOOL)webView:(UIWebView*)webView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType
{
NSURL *url = request.URL;
if ([[url lastPathComponent] isEqualToString:@"skip"]) {
[Tune measureEventName:@"skip"];
}
return YES;
}
Updated 8 months ago