/** * @param array $attributionData * * @return int $id The id of the visit in the database */ protected function trackVisit($attributionData, $cookieToken) { $visit = Visit::create(array_merge(['cookie_token' => $cookieToken, 'landing_domain' => $attributionData['landing_domain'], 'landing_page' => $attributionData['landing_page'], 'referrer_domain' => $attributionData['referrer']['referrer_domain'], 'referrer_url' => $attributionData['referrer']['referrer_url'], 'utm_source' => $attributionData['utm']['utm_source'], 'utm_campaign' => $attributionData['utm']['utm_campaign'], 'utm_medium' => $attributionData['utm']['utm_medium'], 'utm_term' => $attributionData['utm']['utm_term'], 'utm_content' => $attributionData['utm']['utm_content'], 'referral' => $attributionData['referral'], 'created_at' => date('Y-m-d H:i:s'), 'updated_at' => date('Y-m-d H:i:s')], $attributionData['custom'])); return $visit->id; }
/** * Sync visits from the logged in user before they registered. * * @return \Illuminate\Database\Eloquent\Collection */ private function assignPreviousVisits() { return Visit::previousVisits()->update([config('footprints.column_name') => $this->id]); }