'show the consent form if needed
Sub ConsentStateAvailable
Dim consent As ConsentManager = Starter.consent
If consent.ConsentState = consent.STATE_UNKNOWN And consent.IsRequestLocationInEeaOrUnknown Then
'Set last parameter to False if you don't want to show the "pay for ad-free" option.
'Change privacy policy URL.
consent.ShowConsentForm("https://www.mysite.com/privacy.html", True, True, True)
Wait For Consent_FormResult (Success As Boolean, UserPrefersAdFreeOption As Boolean)
If Success Then
Log($"Consent form result: ${consent.ConsentState}, AdFree: ${UserPrefersAdFreeOption}"$)
Else
Log($"Error: ${LastException}"$)
End If
End If
LoadAd
End Sub
'load ads:
Sub LoadAd
Dim builder As AdRequestBuilder
builder.Initialize
Dim consent As ConsentManager = Starter.consent
If consent.IsRequestLocationInEeaOrUnknown Then
If consent.ConsentState = consent.STATE_NON_PERSONALIZED Then
builder.NonPersonalizedAds
Else if consent.ConsentState = consent.STATE_UNKNOWN Then
Return
End If
End If
builder.AddTestDevice("D4AC977CA12D122C4563730CC762C302")
adview1.LoadAdWithBuilder(builder)
End Sub