Corresponding with the release of the 5.0 SDKs, we are requiring the Android Advertising ID (AAID) or Hashed Android ID (MMDID) for Android.

If you have any questions, please contact your Account Manager or contact us to reach one of our trained support professionals.

Android Required Fields

When you are performing conversion tracking for Server-to-Server implementations, you will need to locate some IDs yourself. Below are some quick tips on how to find and hash IDs for conversion tracking. This will also be a valuable companion document for when you test server-to-server implementation.

Passing the AAID

For AAID, Google provides robust documentation and examples on how to retrieve the Android Advertising ID. Even though AAID is the suggested approach going forward, a HDID fallback mechanism (below) will need to be put in place by the developer for devices that are older and do not support AAID.

Passing the MMDID (fallback for devices without AAID available)

For MMDID, our network requires that you use hashing to encode IDs. There are two accepted forms of hashing: Secure Hashing Algorithm (SHA-1) and Message Digest Algorithm (MD5).

When hashing data, the raw value should be properly formatted so that your resulting hash is identical to ours. Matching on hashed IDs requires that they be identical (i.e., case-sensitive and using the correct ID.)

For example, the IDs AbcD123 and ABCD123 are not identical. Please make sure that the ID is correct before hashing it, and please make sure the hashed ID will match us as well.

When using Android server-to-server conversion tracking, you may pass any of the two IDs in the MMDID parameter:

  • Android ID hashed using SHA-1.
  • Android ID hashed using MD-5.

Hashing Android IDs to Create the MMDID

We track conversions on Android devices using the Android ID.

The following code, when implemented, will attempt to obtain and hash the Android ID in MD5 and SHA-1.

...
mmdid = Secure.getString(context.getContentResolver(), Secure.ANDROID_ID);

if(mmdid == null)
return null;

mmdidBuilder = new StringBuilder("mmh_");
try
{
md = MessageDigest.getInstance("MD5");
hashBytes = md.digest(mmdid.getBytes());
mmdidBuilder.append(byteArrayToString(hashBytes));

mmdidBuilder.append("_");
md = MessageDigest.getInstance("SHA1");
hashBytes = md.digest(mmdid.getBytes());
mmdidBuilder.append(byteArrayToString(hashBytes));
}
catch(Exception e)
{
MMSDK.Log.v(e.getMessage());
return null;
}
return mmdidBuilder.toString();
...

User IP Address

Obtain the remote IP address of the HTTP request to your server using the server-side programming language of your choice.

The code “ip_addr” may be changed to whichever variable your prefer.

ASP
Dim ip_addr
ip_addr = Server.URLEncode( Request.ServerVariables( "REMOTE_ADDR" ) )
JSP5
String ip_addr = request.getRemoteAddr();
ip_addr = URLEncoder.encode( ip_addr, "UTF-8" );
PERL
my $ip_addr = URI::URL->new($ENV{'REMOTE_ADDR'})
PHP
@$ip_addr = $_SERVER['REMOTE_ADDR']
Ruby on Rails
ip_addr = request.env['REMOTE_ADDR']
VB.net
Dim ip_addr as String = Server.URLEncode( Request.ServerVariables( "REMOTE_ADDR" )