Precise location data policy

  • Publishers who share precise location data with Google for ads need to comply with new notice and consent requirements based on recent policy updates.

  • The provided code snippets in Kotlin and Java demonstrate one way to inform users about the use and sharing of their location data for personalized advertising, analytics, and attribution.

  • Publishers should customize the provided consent message to accurately reflect their specific data sharing practices.

If you pass precise location data of your users to Google, the Google Publisher Policies provides you with consent requirements and a notice.

If this policy applies to you, the following example sets the title, message, and button text to inform your users of data sharing:

Kotlin

protected fun presentConsentOverlay(context: Context) {
  AlertDialog.Builder(context)
      .setTitle("TITLE")
      .setMessage("MESSAGE_TEXT")
      .setNeutralButton("BUTTON_TEXT") { dialog, which ->
        dialog.cancel()
        Log.d("APP_TAG", "CONSENT_RECEIVED_LOG_MESSAGE")
      }
      .show()
}

// To use the previous function, call:
presentConsentOverlay(this)

Java

protected void presentConsentOverlay(Context context) {
  new AlertDialog.Builder(context)
      .setTitle("TITLE")
      .setMessage("MESSAGE_TEXT")
  .setNeutralButton("BUTTON_TEXT", new DialogInterface.OnClickListener() {
    @Override
    public void onClick(DialogInterface dialog, int which) {
      dialog.cancel();
      Log.d("APP_TAG", "CONSENT_RECEIVED_LOG_MESSAGE");
    }
  })
  .show();
}

// To use the previous method, call:
presentConsentOverlay(this);

Replace the following:

  • TITLE: the title of the consent dialog, for example, Location data.
  • MESSAGE_TEXT: the text of the consent dialog, for example:

    We may use your location and share with third parties for the
    purposes of personalized advertising, analytics, and attributions. To learn
    more, visit our privacy policy at example.com.
    
  • BUTTON_TEXT: the text of the consent dialog button, for example, OK.

  • APP_TAG: the log tag of your application, for example, MainActivity.

  • CONSENT_RECEIVED_LOG_MESSAGE: the log message to record when the user gives consent, for example, Consent received.