feat: WP Engine adaptation (permanent parallel branch)#1
Open
garrettatx wants to merge 2 commits intomainfrom
Open
feat: WP Engine adaptation (permanent parallel branch)#1garrettatx wants to merge 2 commits intomainfrom
garrettatx wants to merge 2 commits intomainfrom
Conversation
added 2 commits
March 5, 2026 13:18
WP Engine's aggressive full-page cache prevents PHP hooks like template_redirect from firing on cached pages. This branch removes the server-side gd_ls_capture() function and template_redirect hook, replacing them with a JS-based capture function in gd_ls_inline_script(). The JS handles: - Parsing window.location.search for UTM params and gclid - Reading document.referrer for referrer classification - Referrer domain lists (search/social/AI) ported from PHP to JS - Cookie writes via document.cookie with same gd_ls_ prefix and 30-day expiration - Same first-touch / last-touch attribution rules as the PHP version - Landing page captured from window.location.href All PHP shortcodes, Formidable Forms, Contact Form 7, and Gravity Forms integrations are unchanged. Cookie names, form field selectors, and attribution behavior are identical between branches. Version bumped to 1.1.0-wpengine.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
template_redirecthook andgd_ls_capture()PHP function — WP Engine's full-page cache prevents these from firing on cached pagescaptureLeadSource()) that runs on every page load, cached or notgmt_offsetfrom PHP to JS so timestamps match WP admin time, not browser local time1.1.0-wpengineAll cookie names, form field selectors, shortcodes, and attribution behavior (first-touch organic / last-touch paid) are identical between branches.
wp-engineis a permanent parallel branch, not a feature branch. It serves a different hosting environment and should never be merged intomain. This PR exists for code review only.When
maingets improvements that apply to both versions (e.g., new referrer domains, security fixes), cherry-pick or merge them intowp-engineselectively.Test plan
gd_ls_*cookies are set via DevTools → Application → Cookiesgd_ls_source=Google,gd_ls_medium=organic[gd_ls_summary]) contain correct data🤖 Generated with Claude Code