diff --git a/scripts/build_ifta_quarterly_campaign.py b/scripts/build_ifta_quarterly_campaign.py index c6506e3..51a1c08 100644 --- a/scripts/build_ifta_quarterly_campaign.py +++ b/scripts/build_ifta_quarterly_campaign.py @@ -249,7 +249,16 @@ def main() -> int: headline = headline_t.format(due=due_human) def attribs(dot, company, state): - lp = f"{LP_LINK}?code={coupon}" if coupon else LP_LINK + # lp_link MUST start its query with `?` so the body's `&utm_source=...` + # appends cleanly. A bare path here yields `/order/ifta-quarterly&utm...` + # (no `?`) which 404s. Carry the carrier's `?dot=` (and `?code=` when a + # coupon is on) exactly like the main builder's lp_link_with_coupon(). + params = [] + if dot: + params.append(f"dot={dot}") + if coupon: + params.append(f"code={coupon}") + lp = f"{LP_LINK}?" + "&".join(params) if params else LP_LINK a = { "dot_number": dot or "", "company": company or "", "state": state or "", "lp_link": lp, diff --git a/scripts/build_trucking_campaigns.py b/scripts/build_trucking_campaigns.py index 716a585..fd74906 100644 --- a/scripts/build_trucking_campaigns.py +++ b/scripts/build_trucking_campaigns.py @@ -232,17 +232,19 @@ def discounted_price_attribs(campaign_type: str, phy_state: str | None, def build_lp_link(campaign_type: str, phy_state: str | None) -> str: """Return the order landing-page URL for a (segment, state).""" - seg = DEFICIENCY_SEGMENTS.get(campaign_type) - slug = seg["lp_slug"] if seg else "dot-full-compliance" - if campaign_type == "state_weight_tax" and phy_state in _WEIGHT_TAX_LP: - slug = _WEIGHT_TAX_LP[phy_state] - if campaign_type == "state_emissions" and phy_state == "CA": - slug = "ca-mcp-carb" - return f"{SITE_DOMAIN}/order/{slug}" + return f"{SITE_DOMAIN}/order/{lp_slug_for(campaign_type, phy_state)}" def lp_slug_for(campaign_type: str, phy_state: str | None = None) -> str: - """The order-page slug (== the discountable service slug) for a segment.""" + """The order-page slug (== the discountable service slug) for a segment. + + Main (non-deficiency) campaigns route to their SPECIFIC service via + PRICE_SLUG_BY_CAMPAIGN (mcs150 -> mcs150-update $79, inactive -> + usdot-reactivation $149). Without this they fell through to the + `dot-full-compliance` ($399) catch-all — sending MCS-150/Inactive carriers + to a 5x-priced page they never asked for (severe conversion killer).""" + if campaign_type in PRICE_SLUG_BY_CAMPAIGN: + return PRICE_SLUG_BY_CAMPAIGN[campaign_type] seg = DEFICIENCY_SEGMENTS.get(campaign_type) slug = seg["lp_slug"] if seg else "dot-full-compliance" if campaign_type == "state_weight_tax" and phy_state in _WEIGHT_TAX_LP: diff --git a/scripts/build_ucr_annual_campaign.py b/scripts/build_ucr_annual_campaign.py index cb298fd..6e0b5b3 100644 --- a/scripts/build_ucr_annual_campaign.py +++ b/scripts/build_ucr_annual_campaign.py @@ -196,7 +196,16 @@ def main() -> int: urgency = urgency_t.format(year=year, due=due_human) def attribs(dot, company, state): - lp = f"{LP_LINK}?code={coupon}" if coupon else LP_LINK + # lp_link MUST start its query with `?` so the body's `&utm_source=...` + # appends cleanly. A bare path here yields `/order/ucr-registration&utm...` + # (no `?`) which 404s. Carry the carrier's `?dot=` (and `?code=` when a + # coupon is on) exactly like the main builder's lp_link_with_coupon(). + params = [] + if dot: + params.append(f"dot={dot}") + if coupon: + params.append(f"code={coupon}") + lp = f"{LP_LINK}?" + "&".join(params) if params else LP_LINK a = { "dot_number": dot or "", "company": company or "", "state": state or "", "lp_link": lp,