iachat/app/models/lead_click.rb
Rodrigo Borba 118f52e239 feat: lead attribution tracking - landing page origin detection
- Cria modelo LeadClick para registrar cliques das landing pages
- Cria modelo LandingHost para mapear hostname → inbox_id
- Endpoint público POST /track/click para receber eventos de clique
- Leads::AttributionMatcherService para correlacionar clique com conversa
- Integração com IncomingMessageWuzapiService para atribuição automática
- API REST para gerenciar LandingHosts por inbox (index/create/destroy)
- UI: nova aba 'Landing Pages' nas configurações da caixa de entrada
- Dashboard API client dedicado (landingHosts.js)
- RuboCop: refatora shift_signature_name, TrackingController, AttributionMatcherService e WuzapiService
2026-03-02 14:40:35 -03:00

30 lines
796 B
Ruby

# == Schema Information
#
# Table name: lead_clicks
#
# id :bigint not null, primary key
# campanha :string
# hostname :string
# ip :string
# lp :string
# source :string
# status :integer
# user_agent :string
# created_at :datetime not null
# updated_at :datetime not null
# contact_id :integer
# conversation_id :integer
# inbox_id :integer
#
# Indexes
#
# index_lead_clicks_on_inbox_id_and_ip_and_status_and_created_at (inbox_id,ip,status,created_at)
#
class LeadClick < ApplicationRecord
enum status: { clicked: 0, converted: 1 }
belongs_to :inbox, optional: true
belongs_to :conversation, optional: true
belongs_to :contact, optional: true
end