'Application_Start
consent.Initialize("consent")
consent.LogDeviceIdForDebugging
consent.AddTestDevice("927915D1-CAE8-4F99-B04C-57345B7DECF4")
consent.SetDebugGeography(True) 'comment for regular operation
consent.RequestInfoUpdate(Array("pub-133333329340"))
Wait For consent_InfoUpdated (Success As Boolean)
If Success = False Then
Log($"Error getting consent state: ${LastException}"$)
End If
Log($"Consent state: ${consent.ConsentState}"$) '0 - UNKNOWN, 1 - NON_PERSONALIZED, 2 - PERSONALIZED
Log(consent.IsRequestLocationInEeaOrUnknown)
ConsentStateAvailable
'**********************
Sub ConsentStateAvailable
If consent.ConsentState = consent.STATE_UNKNOWN And consent.IsRequestLocationInEeaOrUnknown Then
consent.ShowConsentForm(Page1, "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
Sub LoadAd
Dim builder As AdRequestBuilder
builder.Initialize
If consent.IsRequestLocationInEeaOrUnknown And consent.ConsentState <> consent.STATE_PERSONALIZED Then
builder.NonPersonalizedAds
End If
builder.AddTestDevice("bb5420c11bebc5700781d810ca2bc2d0") 'this is a different id than the above. Check the logs for the correct id.
ad.LoadAdWithBuilder(builder)
End Sub