Skip to content

Move scripts server side#103

Merged
stefanoverna merged 5 commits into
mainfrom
li
May 20, 2026
Merged

Move scripts server side#103
stefanoverna merged 5 commits into
mainfrom
li

Conversation

@ronakganatra
Copy link
Copy Markdown
Collaborator

No description provided.

@ronakganatra ronakganatra requested a review from stefanoverna May 20, 2026 09:30
- Gate server-side CAPI on hasMarketingConsent (mirrors client banner logic)
- Parallelize LinkedIn + Front side-effects with the Pipedrive chain
- LINKEDIN_PARTNER_ID as client/public build arg; LINKEDIN_ACCESS_TOKEN
  as runtime secret via cubo config:set; conversion rule IDs inlined
- Drop unused eventId from CAPI payload, add 5s fetch timeout
- Consolidate AW-11079629404 + conversion labels in src/lib/googleAds.ts
- Add CLAUDE.md documenting the three env-var mechanisms
@stefanoverna
Copy link
Copy Markdown
Member

Hey — pushed a round of changes on top. Here's what's different now, no jargon:

LinkedIn conversion tracking now respects cookie consent
Before, we were sending the hashed email to LinkedIn on every sales/partner form submission, regardless of whether the visitor had accepted cookies. Now:

  • Visitors outside Europe / GDPR countries → tracked (they never see the cookie banner, so they're auto-accepted, just like today).
  • GDPR visitors who accepted the cookie banner → tracked.
  • GDPR visitors who rejected or haven't answered yet → not tracked.

This matches what the front-end Insight Tag does, so the two channels behave consistently.

Form submissions are faster
LinkedIn and Front Channel calls now run in parallel with the Pipedrive flow instead of one-after-another. Should shave a few hundred ms off each form submit. No change to what gets sent.

One less double-count risk
The original code was sending a "transaction ID" with each LinkedIn event that included a timestamp — turns out that field is for de-duplicating between Insight Tag and Conversions API, not for guarding against the same user submitting twice. Dropped it (it's optional).

Three Google Ads / LinkedIn config items are now defined once
Previously the Google Ads account ID and the three conversion labels were copy-pasted across 4 files. They now live in one place (src/lib/googleAds.ts) so we can't drift.

Production secrets are wired
LINKEDIN_ACCESS_TOKEN is in AWS Secrets Manager (production only); LINKEDIN_PARTNER_ID is set as a build arg in cubo.json5. Staging won't try to fire the LinkedIn calls (vars are absent → it just skips, no errors).

No tracking lost on slow LinkedIn API
Added a 5-second timeout to the LinkedIn call so a hanging response doesn't hold up the user's form submit. If it times out, we log it but the form still succeeds.

Docs
Added a CLAUDE.md at the root explaining how env vars work in this repo (build-time vs runtime, public vs secret) so we don't keep re-learning it.

@stefanoverna stefanoverna merged commit 36e87d2 into main May 20, 2026
1 check failed
@stefanoverna stefanoverna deleted the li branch May 20, 2026 10:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants