Derive consent mode from geolocation, not banner config
The consent mode is now determined dynamically by the visitor's country and its applicable regulation. The configured consent_mode column is dropped from cookie_banners and added to cookie_consent_records to persist the geo-derived mode at consent-recording time. When no regulation matches, the default is OPT_OUT. Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
@@ -42,6 +42,7 @@ type (
|
||||
SdkVersion string `db:"sdk_version"`
|
||||
Regulation *Regulation `db:"regulation"`
|
||||
CountryCode *CountryCode `db:"country_code"`
|
||||
ConsentMode *CookieConsentMode `db:"consent_mode"`
|
||||
CreatedAt time.Time `db:"created_at"`
|
||||
}
|
||||
|
||||
@@ -94,6 +95,7 @@ SELECT
|
||||
sdk_version,
|
||||
regulation,
|
||||
country_code,
|
||||
consent_mode,
|
||||
created_at
|
||||
FROM
|
||||
cookie_consent_records
|
||||
@@ -180,6 +182,7 @@ INSERT INTO cookie_consent_records (
|
||||
sdk_version,
|
||||
regulation,
|
||||
country_code,
|
||||
consent_mode,
|
||||
created_at
|
||||
) VALUES (
|
||||
@id,
|
||||
@@ -195,6 +198,7 @@ INSERT INTO cookie_consent_records (
|
||||
@sdk_version,
|
||||
@regulation,
|
||||
@country_code,
|
||||
@consent_mode,
|
||||
@created_at
|
||||
)
|
||||
`
|
||||
@@ -213,6 +217,7 @@ INSERT INTO cookie_consent_records (
|
||||
"sdk_version": r.SdkVersion,
|
||||
"regulation": r.Regulation,
|
||||
"country_code": r.CountryCode,
|
||||
"consent_mode": r.ConsentMode,
|
||||
"created_at": r.CreatedAt,
|
||||
}
|
||||
|
||||
@@ -244,6 +249,7 @@ SELECT
|
||||
sdk_version,
|
||||
regulation,
|
||||
country_code,
|
||||
consent_mode,
|
||||
created_at
|
||||
FROM
|
||||
cookie_consent_records
|
||||
@@ -297,6 +303,7 @@ SELECT
|
||||
sdk_version,
|
||||
regulation,
|
||||
country_code,
|
||||
consent_mode,
|
||||
created_at
|
||||
FROM
|
||||
cookie_consent_records
|
||||
|
||||
Reference in New Issue
Block a user