flagsmith icon indicating copy to clipboard operation
flagsmith copied to clipboard

fix: hubspot attribution issues

Open Zaimwa9 opened this issue 4 months ago • 4 comments

Thanks for submitting a PR! Please check the boxes below:

  • [ ] I have added information to docs/ if required so people know about the feature!
  • [x] I have filled in the "Changes" section below?
  • [x] I have filled in the "How did you test this code" section below?
  • [x] I have used a Conventional Commit title for this Pull Request

Changes

⚠️ Hubspot is now in charge of initially creating (if not exists) / associating organisation with users. Reconciliation is based on domain.

  • Pass hubspot cookie from frontend on signup action
  • Reworked the hubspot tracking flow so that:
  1. Every new sign-up creates a hubspot contact (using create_lead_form with or without cookie) and saves HubspotLeads
  2. On UsersOrganisation creation a) If organisation was just created and exists in hubspot => get company data from hubspot, saves the HubspotOrganisation object with correct id b) if doesn't exist in hubspot for X reason => creates it and saves hubspot ID
  3. On UsersOrganisation creation, associates the contact with the
  • Removed the 30min background checker as hubspot creates/associates automatically the company

How did you test this code?

Please describe.

  • Added battery of tests on client and lead_tracker Functionally: Set "ENABLE_HUBSPOT_LEAD_TRACKING": "True" and HUBSPOT_ACCESS_TOKEN Create user, organisation, invite users

Zaimwa9 avatar Jun 10 '25 15:06 Zaimwa9