Person IDs
The person_ids table extracts the ft_id cookie value from form_responses.url and stores it alongside the person_id. Because a person can submit multiple forms — each with a different ft_id — this is a one-to-many table. The ft_id is the bridge between a Slate person and their GA4 session data.
Create person_ids
Section titled “Create person_ids”CREATE OR REPLACE TABLE person_ids ( person_id UUID, id_type VARCHAR, id_value VARCHAR,);Extract ft_id from form_response URLs
Section titled “Extract ft_id from form_response URLs”DELETE FROM person_idsWHERE id_type = 'ft_id';
INSERT INTO person_idsSELECT DISTINCT fr.record_id AS person_id, 'ft_id' AS id_type, regexp_extract(fr.url, '[?&]ft_id=([^&]+)', 1) AS id_valueFROM form_responses frJOIN persons p ON fr.record_id = p.idWHERE fr.record_id IS NOT NULL AND regexp_extract(fr.url, '[?&]ft_id=([^&]+)', 1) IS NOT NULL AND regexp_extract(fr.url, '[?&]ft_id=([^&]+)', 1) <> '';Schema
Section titled “Schema”| Column | Type |
|---|---|
| person_id | uuid |
| id_type | varchar |
| id_value | varchar |