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:
Search Adobe Air Plugin Version 5.0
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);
Search Adobe Air Plugin Version 4.0
mobileAppTracker.setUserId("userId");
mobileAppTracker.setFacebookUserId("facebookUserId");
mobileAppTracker.setGoogleUserId("googleUserId");
mobileAppTracker.setTwitterUserId("twitterUserId");
mobileAppTracker.setLocation(47.61, -122.33, 55);
var matEvent:Dictionary = new Dictionary();
matEvent.name = "search";
matEvent.currency = "USD";
matEvent.searchString = "hotel";
matEvent.date1 = Date.UTC(2015, 4, 21).toString();
matEvent.date2 = Date.UTC(2015, 4, 23).toString();
matEvent.quantity = 3;
matEvent.eventItems = eventItems;
mobileAppTracker.measureEvent(matEvent);
Search Android SDK Version 6.0+
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));
Search Android SDK Version 4.0+
Tune 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));
Search Cocos2dx Plugin Version 3.9
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);
Search iOS SDK Version 4.7-3.10
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];
Search Javascript SDK Version 3.2
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});
Search PhoneGap Plugin Version 5.0.0
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);
Search PhoneGap Plugin Version 3.8+
mobileAppTracker.setUserId("userId");
mobileAppTracker.setFacebookUserId("facebookUserId");
mobileAppTracker.setGoogleUserId("googleUserId");
mobileAppTracker.setTwitterUserId("twitterUserId");
mobileAppTracker.setLocationWithAltitude(47.61, -122.33, 55);
var matEvent = {
"name": "search",
"currency": "USD",
"eventItems": eventItems,
"searchString": "hotel",
"date1": new Date(2015,4,21).getTime(),
"date2": new Date(2015,4,23).getTime(),
"quantity": 3
};
mobileAppTracker.measureEvent(matEvent);
Search Unity Plugin Version 4.0.0+
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);
Search Unity Plugin Version 3.8+
MATBinding.SetUserId("userId");
MATBinding.SetFacebookUserId("facebookUserId");
MATBinding.SetGoogleUserId("googleUserId");
MATBinding.SetTwitterUserId("twitterUserId");
MATBinding.SetLocation(47.61, -122.33, 55);
MATEvent matEvent = new MATEvent("search");
matEvent.eventItems = eventItems;
matEvent.searchString = "hotel";
matEvent.date1 = new DateTime(2015, 4, 21);
matEvent.date2 = new DateTime(2015, 4, 23);
matEvent.quantity = 3;
MATBinding.MeasureEvent(matEvent);
Search Windows SDK Version 3.2
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);
Search Xamarin Plugin Version for 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);
Search Xamarin Plugin Version for 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));
Search Missing Code Example
Unable to load code example.
Search
Select a preferred platform.
Note: In-App Marketing does not support events or event item data for Search. Please see Event Measurement and the Event Tags documentation for more information.