fix: aumenta janela de atribuição para 30min e sanitiza hostname no frontend
- attribution_matcher_service: window 10min → 30min (mais realista para jornada do lead) - LandingHostsConfig.vue: strip automático de https://, www e trailing slash antes de salvar
This commit is contained in:
parent
118f52e239
commit
a73689dce4
@ -74,12 +74,21 @@ export default {
|
|||||||
async addHost() {
|
async addHost() {
|
||||||
if (!this.newHostname.trim()) return;
|
if (!this.newHostname.trim()) return;
|
||||||
this.isSaving = true;
|
this.isSaving = true;
|
||||||
|
|
||||||
|
// Sanitiza: remove protocolo, www, barras e espaços
|
||||||
|
const cleanHostname = this.newHostname
|
||||||
|
.trim()
|
||||||
|
.toLowerCase()
|
||||||
|
.replace(/^https?:\/\//i, '')
|
||||||
|
.replace(/^www\./, '')
|
||||||
|
.replace(/\/.*$/, '');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const { data } = await landingHostsApi.createHost(
|
const { data } = await landingHostsApi.createHost(
|
||||||
this.currentAccountId,
|
this.currentAccountId,
|
||||||
this.inbox.id,
|
this.inbox.id,
|
||||||
{
|
{
|
||||||
hostname: this.newHostname.trim().toLowerCase(),
|
hostname: cleanHostname,
|
||||||
unit_code: this.newUnitCode.trim().toUpperCase(),
|
unit_code: this.newUnitCode.trim().toUpperCase(),
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
@ -25,7 +25,7 @@ class Leads::AttributionMatcherService
|
|||||||
def find_matching_click
|
def find_matching_click
|
||||||
base_query = LeadClick
|
base_query = LeadClick
|
||||||
.where(status: :clicked, inbox_id: @inbox_id)
|
.where(status: :clicked, inbox_id: @inbox_id)
|
||||||
.where('created_at > ?', 10.minutes.ago)
|
.where('created_at > ?', 30.minutes.ago)
|
||||||
|
|
||||||
return base_query.where(ip: @inbound_ip).order(created_at: :desc).first if @inbound_ip.present?
|
return base_query.where(ip: @inbound_ip).order(created_at: :desc).first if @inbound_ip.present?
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user