|
| 1 | +This file outlines how data is stored within FooConvert. |
| 2 | + |
| 3 | +FooConvert allows you to create 3 different types of widgets, which are stored as custom post types within WordPress. |
| 4 | + |
| 5 | +Bar widgets use the post type "fc-bar". |
| 6 | + |
| 7 | +Flyout widgets use the post type "fc-flyout". |
| 8 | + |
| 9 | +Popup widgets use the post type "fc-popup". |
| 10 | + |
| 11 | +The FooConvert plugin creates a single custom database table in the database when the plugin is installed. |
| 12 | + |
| 13 | +The table is called "fooconvert_events", and it's purpose is to store events for widgets analytics. |
| 14 | + |
| 15 | +The SQL statement for creating the "fooconvert_events" table is: |
| 16 | + |
| 17 | +CREATE TABLE fooconvert_events ( |
| 18 | + id bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
| 19 | + widget_id bigint(20) unsigned NOT NULL, |
| 20 | + event_type varchar(255) NOT NULL, |
| 21 | + event_subtype varchar(255) DEFAULT NULL, |
| 22 | + conversion tinyint(1) DEFAULT NULL, |
| 23 | + sentiment tinyint(1) DEFAULT NULL, |
| 24 | + page_url text DEFAULT NULL, |
| 25 | + device_type varchar(50) DEFAULT NULL, |
| 26 | + anonymous_user_guid varchar(255) DEFAULT NULL, |
| 27 | + user_id bigint(20) unsigned DEFAULT NULL, |
| 28 | + extra_data longtext DEFAULT NULL, |
| 29 | + timestamp datetime DEFAULT $timestamp_default, |
| 30 | + PRIMARY KEY (id) |
| 31 | +); |
| 32 | + |
| 33 | +An explanation of each field in the "fooconvert_events" table: |
| 34 | + - "id" is the primary key. |
| 35 | + - "widget_id" is the id of the widget that created the event. this is a foreign key to the WordPress post table. |
| 36 | + - "event_type" is the type of event. This is the most important field. It must be one of: 'open', 'click', 'close', 'update'. |
| 37 | + - "event_subtype" is the subtype of the event. Can be either 'engagement' or NULL. |
| 38 | + - "conversion" is a boolean that is true if the event is a conversion. |
| 39 | + - "sentiment" is a boolean that is true if the event sentiment is positive, false if it is negative, and null if it is neutral. |
| 40 | + - "page_url" is the url of the page that created the event. |
| 41 | + - "device_type" is the type of device when the event happened. |
| 42 | + - "user_id" is the WordPress user when the event happened. Will be null if not logged in. |
| 43 | + - "anonymous_user_guid" is the unique id of an anonymous user from the frontend. Will be null if logged in. |
| 44 | + - "extra_data" holds any extra data associated with the event. It can hold specific info about a conversion or an update. |
| 45 | + - "timestamp" is when the event happened. |
| 46 | + |
| 47 | +There is a default retention period of 14 days for widget analytics. All event data older than the retention period is deleted in a daily cron job. |
0 commit comments