Add banner ID to probo_consent cookie
Include a `bid` field in the consent cookie so it explicitly identifies which cookie banner it belongs to, making validation direct instead of relying on the visitor ID as an implicit discriminator. Existing cookies without `bid` self-heal on the next load by falling through to the API fetch. Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
@@ -39,6 +39,7 @@ type (
|
||||
UserAgent *string `db:"user_agent"`
|
||||
ConsentData json.RawMessage `db:"consent_data"`
|
||||
Action CookieConsentAction `db:"action"`
|
||||
SdkVersion string `db:"sdk_version"`
|
||||
CreatedAt time.Time `db:"created_at"`
|
||||
}
|
||||
|
||||
@@ -77,6 +78,7 @@ SELECT
|
||||
user_agent,
|
||||
consent_data,
|
||||
action,
|
||||
sdk_version,
|
||||
created_at
|
||||
FROM
|
||||
cookie_consent_records
|
||||
@@ -160,6 +162,7 @@ INSERT INTO cookie_consent_records (
|
||||
user_agent,
|
||||
consent_data,
|
||||
action,
|
||||
sdk_version,
|
||||
created_at
|
||||
) VALUES (
|
||||
@id,
|
||||
@@ -172,6 +175,7 @@ INSERT INTO cookie_consent_records (
|
||||
@user_agent,
|
||||
@consent_data,
|
||||
@action,
|
||||
@sdk_version,
|
||||
@created_at
|
||||
)
|
||||
`
|
||||
@@ -187,6 +191,7 @@ INSERT INTO cookie_consent_records (
|
||||
"user_agent": r.UserAgent,
|
||||
"consent_data": r.ConsentData,
|
||||
"action": r.Action,
|
||||
"sdk_version": r.SdkVersion,
|
||||
"created_at": r.CreatedAt,
|
||||
}
|
||||
|
||||
@@ -216,6 +221,7 @@ SELECT
|
||||
user_agent,
|
||||
consent_data,
|
||||
action,
|
||||
sdk_version,
|
||||
created_at
|
||||
FROM
|
||||
cookie_consent_records
|
||||
|
||||
Reference in New Issue
Block a user