To ensure the GDPR consent form only appears for users located in the EEA, you must disable debugging settings and allow the Google UMP SDK to automatically detect IP geolocation.
The code you shared uses ConsentDebugSettings, which forces the SDK to simulate geolocation within the EEA (European Economic Area) or outside the EEA, depending on the value of InEEA. This bypasses actual IP detection.
geo = 1 - forces geolocation within the EEA
geo = 2 - forces geolocation outside the EEA
Even if you disable a line, if ConsentDebugSettings is initialized and applied to ConsentRequestParameters, the SDK behaves as if the user were in the EEA.
To display the form only for European IP addresses, you must:
Remove or completely comment out the SetConsentDebugParameters block in production.
' Do not call this method in production
' SetConsentDebugParameters(TestId, True)
Do not include ConsentDebugSettings in ConsentRequestParameters.
If ConsentDebugSettings.IsInitialized Then
' Remove this line in production
' ConsentRequestParameters.RunMethod("setConsentDebugSettings", Array(ConsentDebugSettings))
End If
Let the Google UMP SDK automatically handle IP geolocation: The SDK uses the user's IP address to determine if they are in the EEA. If so, the form will be displayed automatically.