Class EngageBySailthru
-
- All Implemented Interfaces:
public final class EngageBySailthru
Separates logic between the core Marigold SDK functionality and that of the Sailthru only apps
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interface
EngageBySailthru.TrackHandler
-
Constructor Summary
Constructors Constructor Description EngageBySailthru()
-
Method Summary
Modifier and Type Method Description final Unit
trackPageview(URI url, List<String> tags, EngageBySailthru.TrackHandler handler)
Asynchronously registers that the given "page" has been viewed with Marigold SPM. final Unit
trackImpression(String sectionId, List<URI> urls, EngageBySailthru.TrackHandler handler)
Asynchronously registers an impression - a reasonable expectation that a user has seen a piece of content - with Marigold SPM. final Unit
trackClick(String sectionId, URI url, EngageBySailthru.TrackHandler handler)
Asynchronously registers with Marigold SPM that a section has been clicked/tapped on, transitioning the user to a detail view final Unit
setUserEmail(String userEmail, Marigold.MarigoldHandler<Void> handler)
Set the User's Email. final Unit
setUserId(String userId, Marigold.MarigoldHandler<Void> handler)
Set an arbitrary external User ID. final Unit
logEvent(String value, JSONObject vars)
Log a Marigold Mobile event with associated vars. final Unit
logEvent(String value)
Log a Marigold Mobile event with associated vars. final Unit
logEvent(EventSource source, String value)
Log an event from a third party source. final Unit
clearEvents(Marigold.MarigoldHandler<Void> handler)
Clear the custom events from the device data. final Unit
setProfileVars(JSONObject vars, Marigold.MarigoldHandler<Void> handler)
Set the profile vars through the SDK. final Unit
getProfileVars(Marigold.MarigoldHandler<JSONObject> handler)
Retrieve the profile vars set on the server. final Uri
handleSailthruLink(Uri uri, Marigold.MarigoldHandler<Void> handler)
If you're using Marigold email with universal links, your application will open with an encoded Marigold link url. final Unit
logPurchase(Purchase purchase, Marigold.MarigoldHandler<Void> handler)
Logs a purchase with the Marigold platform. final Unit
logAbandonedCart(Purchase purchase, Marigold.MarigoldHandler<Void> handler)
Logs a cart abandonment with the Marigold platform. -
-
Method Detail
-
trackPageview
final Unit trackPageview(URI url, List<String> tags, EngageBySailthru.TrackHandler handler)
Asynchronously registers that the given "page" has been viewed with Marigold SPM. Note that a Content View here directly corresponds to a page view in SPM.
- Parameters:
url
- The URL of the page we're tracking a view of.tags
- Tags for this page.handler
- an instance of TrackHandler.
-
trackImpression
final Unit trackImpression(String sectionId, List<URI> urls, EngageBySailthru.TrackHandler handler)
Asynchronously registers an impression - a reasonable expectation that a user has seen a piece of content - with Marigold SPM. Can be used in conjunction with
RecyclerView.Adapter#onViewAttachedToWindow
or similar to know when a particular content item has entered the user's viewport.- Parameters:
sectionId
- the Section ID on Marigold SPM corresponding to the section being viewed.urls
- a List of the URLs of the items contained within this section.handler
- an instance of TrackHandler.
-
trackClick
final Unit trackClick(String sectionId, URI url, EngageBySailthru.TrackHandler handler)
Asynchronously registers with Marigold SPM that a section has been clicked/tapped on, transitioning the user to a detail view
- Parameters:
sectionId
- the ID of the section to track a click for.url
- the URL of the detail being transitioned to.handler
- an instance of TrackHandler.
-
setUserEmail
final Unit setUserEmail(String userEmail, Marigold.MarigoldHandler<Void> handler)
Set the User's Email.
- Parameters:
userEmail
- the User's Emailhandler
- MarigoldHandler callback on success or failure to update user Email
-
setUserId
final Unit setUserId(String userId, Marigold.MarigoldHandler<Void> handler)
Set an arbitrary external User ID.
- Parameters:
userId
- An external User IDhandler
- MarigoldHandler callback on success or failure to update user ID
-
logEvent
@JvmOverloads() final Unit logEvent(String value, JSONObject vars)
Log a Marigold Mobile event with associated vars. If value is null or an empty string, no event will be generated.
- Parameters:
value
- The event's name.vars
- The vars associated with this event.
-
logEvent
@JvmOverloads() final Unit logEvent(String value)
Log a Marigold Mobile event with associated vars. If value is null or an empty string, no event will be generated.
- Parameters:
value
- The event's name.
-
logEvent
final Unit logEvent(EventSource source, String value)
Log an event from a third party source. If value is null or an empty string, no event will be generated.
- Parameters:
source
- An EventSource identifying the source of the third-party event.value
- The event's name.
-
clearEvents
final Unit clearEvents(Marigold.MarigoldHandler<Void> handler)
Clear the custom events from the device data.
- Parameters:
handler
- callback handler
-
setProfileVars
final Unit setProfileVars(JSONObject vars, Marigold.MarigoldHandler<Void> handler)
Set the profile vars through the SDK.
- Parameters:
vars
- JSONObject containing the vars to set on the server.handler
- callback handler.
-
getProfileVars
final Unit getProfileVars(Marigold.MarigoldHandler<JSONObject> handler)
Retrieve the profile vars set on the server.
- Parameters:
handler
- callback handler.
-
handleSailthruLink
final Uri handleSailthruLink(Uri uri, Marigold.MarigoldHandler<Void> handler)
If you're using Marigold email with universal links, your application will open with an encoded Marigold link url. This method will decode the link URL and return its canonical location (ie https://link.sailthru.com/blahblah will redirect to https://www.sailthru.com/careers/list/, the link's canonical location), as well as making sure that the clickthrough metrics for this link are correctly attributed in the Marigold platform. This method should be called from your receiving activity's
onStart()
method, and handle the starting intent's link data- Parameters:
uri
- the Marigold Link to be unrolled- Returns:
the destination that the Marigold link points to
-
logPurchase
final Unit logPurchase(Purchase purchase, Marigold.MarigoldHandler<Void> handler)
Logs a purchase with the Marigold platform. This can be used for mobile purchase attribution.
- Parameters:
purchase
- The purchase to log with the platform.handler
- callback handler.
-
logAbandonedCart
final Unit logAbandonedCart(Purchase purchase, Marigold.MarigoldHandler<Void> handler)
Logs a cart abandonment with the Marigold platform. Use this to initiate cart abandoned flows.
- Parameters:
purchase
- The abandoned purchase to log with the platform.handler
- callback handler.
-
-
-
-