The following events are available to use.
Metadata Event
Example
Personalization personalization = new Personalization(user, account);
MetaData data = new MetaData();
data.setMetadata(new Language("INR"));
// Passing raw data while reporting
new Thread(new Runnable()
{
@Override
public void run()
{
personalization.report(EventTypes.ContextMetadata, data);
}
}).start();
ScreenSize Event
Example
Personalization personalization = new Personalization(user, account);
ScreenSize screenSize = new ScreenSize();
screenSize.setHeight(1211);
screenSize.setWidth(2323);
// Passing raw data while reporting
new Thread(new Runnable()
{
@Override
public void run()
{
personalization.report(EventTypes.ContextScreenSize, screenSize);
}
}).start();
UserAgent Event
Imports UserAgent data from the device. This data represents information about the device of the user.
Example
Personalization personalization = new Personalization(user, account);
personalization.report(EventTypes.ContextUserAgent, new UserAgent("test_agent"));
Personalization personalization = new Personalization(user, account);
public DeviceDetails getData()
{
DeviceDetails deviceDetails = new DeviceDetails();
deviceDetails.setDevice(Build.DEVICE);
deviceDetails.setModel(Build.MODEL);
deviceDetails.setProductName(Build.BRAND);
deviceDetails.setOsVersion(System.getProperty("os.version"));
deviceDetails.setOsApiLevel(Build.VERSION.RELEASE + "(" + Build.VERSION.SDK_INT + ")");
return deviceDetails;
}
DeviceDetails details = getData();
String data = personalization.refactorDeviceDetails(details);
// Passing raw data while reporting
new Thread(new Runnable()
{
@Override
public void run()
{
personalization.report(EventTypes.ContextUserAgent, new UserAgent(data));
}
}).start();
ProductView Event
Example
Personalization personalization = new Personalization(user, account);
ProductView productView = new ProductView();
productView.setProducts(new String[]
{
"product1",
"product2"
});
//passing raw data while reporting event
new Thread(new Runnable()
{
@Override
public void run()
{
personalization.report(EventTypes.ContextProductView, productView);
}
}).start();
Coordinates Event
Reports the coordinates of the customer.
Example
Personalization personalization = new Personalization(user, account);
Coordinates coordinates = new Coordinates();
coordinates.setLatitude("1212");
coordinates.setLongitude("2323");
// Passing raw data while reporting
new Thread(new Runnable()
{
@Override
public void run()
{
personalization.report(EventTypes.ContextCoordinates, coordinates);
}
}).start();
Referrer Event
Reports the referrer.
Example
Personalization personalization = new Personalization(user, account);
Referrer referrer = new Referrer();
referrer.setReferrer("test.com");
// Passing raw data while reporting
new Thread(new Runnable()
{
@Override
public void run()
{
personalization.report(EventTypes.ContextReferrer, referrer);
}
}).start();
CustomVariable Event
Example
Personalization personalization = new Personalization(user, account);
CustomVariable customVariable = new CustomVariable();
customVariable.setValue("key");
customVariable.setVariable("value");
CustomVariables customVariables = new CustomVariables();
customVariables.setCustomVariables(new CustomVariable[]
{
customVariable
});
// Passing raw data while reporting
new Thread(new Runnable()
{
@Override
public void run()
{
personalization.report(EventTypes.ContextCustomVariables, customVariables);
}
}).start();
PageEvents Event
Reports any events on the page.
Example
Personalization personalization = new Personalization(user, account);
PageEvents pageEvents = new PageEvents();
pageEvents.setPageEvents(new String[]
{
"pageEvent_1",
"pageEvent_2"
});
// Passing Raw data while reporting
new Thread(new Runnable()
{
@Override
public void run()
{
personalization.report(EventTypes.RecordPageEvents, pageEvents);
}
}).start();
PageView Event
Reports when a customer views a specified page.
Example
Personalization personalization = new Personalization(user, account);
PageView pageView = new PageView();
pageView.setBreadcrumbs(new String[]
{
"breadcrums_1",
"breadcrums_2",
"breadcrums_3"
});
pageView.setCategories(new String[]
{
"category_1",
"category_2"
});
pageView.setPageType("home_page");
pageView.setUrl("NA");
// Passing raw data while reporting
new Thread(new Runnable()
{
@Override
public void run()
{
personalization.report(EventTypes.ContextPageView, pageView);
}
}).start();
ProductThumbnail Event
Reports when a customer views a product thumbnail.
Example
Personalization personalization = new Personalization(user, account);
ProductThumbnailView productThumbnailView = new ProductThumbnailView();
productThumbnailView.setProducts(new String[]
{
"product1",
"product2",
"product3"
});
// Passing raw data while reporting
new Thread(new Runnable()
{
@Override
public void run()
{
personalization.report(EventTypes.ContextProductThumbnailView, productThumbnailView);
}
}).start();
ProductDetailView Event
Reports when a customer views a product detail page.
Example
Personalization personalization = new Personalization(user, account);
Product product_111 = new Product();
product_111.setProductId("PID_111");
product_111.setSku("SKU_111");
Product product_222 = new Product();
product_222.setProductId("PID_222");
product_222.setSku("SKU_222");
ProductDetailView detailView = new ProductDetailView();
detailView.setProducts(new Product[]
{
product_111,
product_222
});
// Passing raw data while reporting
new Thread(new Runnable()
{
@Override
public void run()
{
personalization.report(EventTypes.ContextProductDetailView, detailView);
}
}).start();
RecClicks Event
Reports recommendations click events.
Example
Personalization personalization = new Personalization(user, account);
RecClicks recClicks = new RecClicks();
recClicks.setRecClicks(new String[]
{
"test_recclick_1",
"test_recclick_2"
});
// Passing raw data while reporting
new Thread(new Runnable()
{
@Override
public void run()
{
personalization.report(EventTypes.RecordRecClicks, recClicks);
}
}).start();
RecImpressions Event
Reports recommendations impression events.
Example
Personalization personalization = new Personalization(user, account);
RecImpressions recimpressions = new RecImpressions();
recimpressions.setRecImpressions(new String[]
{
"test_rec_imp_1",
"test_rec_imp_2"
});
// Passing raw data while reporting
new Thread(new Runnable()
{
@Override
public void run()
{
personalization.report(EventTypes.RecordRecImpressions, recimpressions);
}
}).start();
Impressions Event
Reports impression events.
Example
Personalization personalization = new Personalization(user, account);
Impressions impressions = new Impressions();
impressions.setimpressionIds(new String[]
{
"testimpressionsId1",
"testimpressionsId2"
});
// Passing raw data while reporting
new Thread(new Runnable()
{
@Override
public void run()
{
personalization.report(EventTypes.RecordImpressions, impressions);
}
}).start();
Cart Event
Reports when a customer adds a product to their cart. Import and use the CartLinesData
interface for this event. CartLine
is the data structure used by this interface.
Example
Personalization personalization = new Personalization(user, account);
CartLine cartLine = new CartLine();
cartLine.setCurrency("INR");
cartLine.setPid("PID");
cartLine.setQuantity(2);
cartLine.setSku("SKU");
cartLine.setUnitPrice("000");
cartLine.setValue("11");
CartLine cartLine2 = new CartLine();
cartLine2.setCurrency("USA");
cartLine2.setPid("PID");
cartLine2.setQuantity(2);
cartLine2.setSku("SKU");
cartLine2.setUnitPrice("9999");
cartLine2.setValue("111");
Cart cart = new Cart();
cart.setCartLines(new CartLine[]
{
cartLine,
cartLine2
});
// Passing raw data while reporting
new Thread(new Runnable()
{
@Override
public void run()
{
personalization.report(EventTypes.ContextCart, cart);
}
}).start();
AddToCart Event
Example
Personalization personalization = new Personalization(user, account);
CartLine cartLine = new CartLine();
cartLine.setCurrency("INR");
cartLine.setPid("PID");
cartLine.setQuantity(2);
cartLine.setSku("SKU");
cartLine.setValue("11");
CartLine cartLine2 = new CartLine();
cartLine2.setCurrency("USA");
cartLine2.setPid("PID");
cartLine2.setQuantity(2);
cartLine2.setSku("SKU");
cartLine2.setValue("111");
AddToCart addToCart = new AddToCart();
addToCart.setCartLines(new CartLine[]
{
cartLine,
cartLine2
});
new Thread(new Runnable()
{
@Override
public void run()
{
personalization.report(EventTypes.ContextAddToCart, addToCart);
}
}).start();
IpAddress Event
Example
Personalization personalization = new Personalization(user, account);
IpAddress address = new IpAddress();
address.setIpAddress("127.0.0.0.");
//passing raw data while reporting
new Thread(new Runnable()
{
@Override
public void run()
{
personalization.report(EventTypes.ContextIpAddress, address);
}
}).start();
ClosedSession Event
Example
Personalization personalization = new Personalization(user, account);
ClosedSession closedSession = new ClosedSession();
closedSession.setClosedSession(new com.monetate.personalization.androidsdk.model.objects.ClosedSession("test_id"));
closedSession.setVersion("test_version");
// Passing raw data while reporting
new Thread(new Runnable()
{
@Override
public void run()
{
personalization.report(EventTypes.ContextClosedSession, closedSession);
}
}).start();
Purchase Event
Personalization personalization = new Personalization(user, account);
PurchaseLine line = new PurchaseLine();
line.setCurrency("INR");
line.setPid("PID");
line.setQuantity(2);
line.setSku("SKU");
line.setValue("12.00");
Purchase purchase = new Purchase();
purchase.setPurchaseLines(new PurchaseLine[]
{
line
});
purchase.setAccount("tes_account");
purchase.setDomain("test_domain");
purchase.setInstance("test_instance");
purchase.setPurchaseId("test_purchase_id");
//passing raw data while reporting
new Thread(new Runnable()
{
@Override
public void run()
{
personalization.report(EventTypes.ContextPurchase, purchase);
}
}).start();