docs/shipping.md
This document outlines the changes made to implement the UTM link tracking feature.
The seller interface for managing UTM links resides under the "Analytics" tab in the seller dashboard.
Completed Tasks:
The following changes were made to the database:
Completed Tasks:
utm_links table with the following fields and indices:
seller_id (bigint, required, indexed)title (string, required)target_resource_type (string, required, indexed)target_resource_id (bigint, optional, indexed)permalink (string, required, unique index)utm_source (string, required, indexed as part of a composite unique index with other UTM fields and the target resource)utm_medium (string, required, indexed as part of a composite unique index with other UTM fields and the target resource)utm_campaign (string, required, indexed as part of a composite unique index with other UTM fields and the target resource and individually)utm_term (string, optional, indexed as part of a composite unique index with other UTM fields and the target resource)utm_content (string, optional, indexed as part of a composite unique index with other UTM fields and the target resource)first_click_at (datetime)last_click_at (datetime)total_clicks (integer, default: 0)unique_clicks (integer, default: 0)ip_address (string)browser_guid (string)utm_link_visits table with the following fields and indices:
utm_link_id (bigint, required, indexed)user_id (bigint, optional, indexed)referrer (string)ip_address (string, required, indexed)user_agent (string)browser_guid (string, required, indexed)country_code (string, required)created_at (datetime, indexed)utm_link_driven_sales table with the following fields and indices:
utm_link_id (bigint, required, indexed)utm_link_visit_id (bigint, required, indexed, and part of a unique composite index with purchase_id)purchase_id (bigint, required, indexed, and part of a unique composite index with utm_link_visit_id)UtmLink, UtmLinkVisit, UtmLinkDrivenSale) with appropriate relationships (belongs_to, has_many) and validations (presence, uniqueness, format, etc.).Implemented UTM link click/visit tracking.
Completed Tasks:
GET "/u/:permalink" routing to UtmLinkTrackingController#show. This route handles UTM link clicks and redirects.cookies[:_gumroad_guid] along with referrer, IP address, user agent, and country code, storing data in the UtmLinkVisit model.total_clicks, unique_clicks) in the UtmLink model.Implemented UTM link sale conversion/attribution.
Completed Tasks:
_gumroad_guid cookie.