Experience Cloud ID Service Methods

Here are the Experience Cloud ID methods that are provided by the Android library.

The SDK currently supports multiple Adobe Experience Cloud Solutions, including Analytics, Target, Audience Manager, and the Experience Cloud ID Service.

Methods are prefixed according to the solution. For example, Experience Cloud ID methods are prefixed with visitor. For more information, see Experience Cloud ID Configuration.

Method Description
public static String appendToURL(final String URL)

Appends Adobe visitor data to a URL string for use with the Adobe JavaScript library. You must have Mobile SDK 4.12+ to use this method. For more information, see Append Visitor ID Helper Function.

Important: This method can cause a blocking network call. Do not call this on time-sensitive threads.
  • Input: URL<java.lang.String>

    A required URL string to which the visitor information is appended.

  • Output: URL<java.lang.String>

    String with the visitor information appended.

Example:

String urlSample = "http://example.com"; 
        String urlWithAdobeVisitorInfo = Visitor.appendToURL(urlSample); 

        Intent i = new Intent(Intent.ACTION_VIEW); 
        i.setData(Uri.parse(urlWithAdobeVisitorInfo)); 
        startActivity(i); 
getMarketingCloudId

Retrieves the Experience Cloud ID from the visitor ID service.

  • Syntax:
    public static String getMarketingCloudId();
  • Example:
    String mcid = Visitor.getMarketingCloudId();
Important: This method can cause a blocking network call and should not be called from a UI thread.

syncIdentifiers

With the Experience Cloud ID, you can set additional customer IDs that can be associated with each visitor. The Visitor API accepts multiple customer IDs for the same visitor, with a customer type identifier to separate the scope of the different customer IDs. This method corresponds to setCustomerIDs in the JavaScript library.

  • Syntax:
    public static void syncIdentifiers(Map<String, String> identifiers);
  • Example:
    Map<String, String> identifiers = new HashMap<String, String>();
    identifiers.put("idType", "idValue");
    Visitor.syncIdentifiers(identifiers);

syncIdentifer

Synchronizes the provided identifier type and value to the Visitor ID service. Pass in the authenticationState as one of the following values:

  • VisitorID.VisitorIDAuthenticationState.VISITOR_ID_AUTHENTICATION_STATE_UNKNOWN
  • VisitorID.VisitorIDAuthenticationState.VISITOR_ID_AUTHENTICATION_STATE_AUTHENTICATED
  • VisitorID.VisitorIDAuthenticationState.VISITOR_ID_AUTHENTICATION_STATE_LOGGED_OUT
  • Syntax:
    public static void syncIdentifier(final String identifierType, final String identifier, final VisitorID.VisitorIDAuthenticationState authenticationState);
  • Example:
    Visitor.syncIdentifier("myIdType", "valueForUser", VisitorID.VisitorIDAuthenticationState.VISITOR_ID_AUTHENTICATION_STATE_LOGGED_OUT);

syncIdentifiers

Synchronizes the provided identifiers to the ID service. Pass in the authenticationState as one of the following values:

  • VisitorID.VisitorIDAuthenticationState.VISITOR_ID_AUTHENTICATION_STATE_UNKNOWN
  • VisitorID.VisitorIDAuthenticationState.VISITOR_ID_AUTHENTICATION_STATE_AUTHENTICATED
  • VisitorID.VisitorIDAuthenticationState.VISITOR_ID_AUTHENTICATION_STATE_LOGGED_OUT
  • Syntax:
    public static void syncIdentifiers(final Map<String, String> identifiers, final VisitorID.VisitorIDAuthenticationState authenticationState);
  • Example:
    Map<String, String> identifiers = new HashMap<String, String>();
    	identifiers.put("myIdType", "valueForUser");
    	Visitor.syncIdentifiers(identifiers, VisitorID.VisitorIDAuthenticationState.VISITOR_ID_AUTHENTICATION_STATE_AUTHENTICATED);

getIdentifiers

Retrieves a list of read-only ADBVisitorID objects.

  • Syntax:
    public static List<VisitorID> getIdentifiers();
  • Example:
    List<VisitorID> myVisitorIDs = Visitor.getIdentifiers();

Public Methods

public class VisitorID {
	public final String idOrigin;
	public final String idType;
	public final String id;
	public VisitorIDAuthenticationState authenticationState;

	public enum VisitorIDAuthenticationState {
		VISITOR_ID_AUTHENTICATION_STATE_UNKNOWN(0),
	    VISITOR_ID_AUTHENTICATION_STATE_AUTHENTICATED(1),
	    VISITOR_ID_AUTHENTICATION_STATE_LOGGED_OUT(2);
	}
}