I’ve been looking into this issue and I got some interesting insights.
After a close inspection of the source code of Leadpages’ WordPress plugin, I’ve identified why our plugin doesn’t work with it. Apparently, Leadpages’ plugin doesn’t use any of the “usual” WordPress functions to render the final HTML. Instead, it relies on “low-level” database queries to retrieve the appropriate data, which explains why our plugin wasn’t able to show you alternative content in the results page.
I tweaked our code so that it also takes into account this “low-level” DB calls, and I was able to get it running. Unfortunately, when I accessed the website in incognito and checked if our plugin was able to load alternative content and track user events in a Leadpages’ page, I found out it’s impossible.
Apparently, Leadpages bypasses WordPress completely: it retrieves the HTML from their servers and returns it “as is.” As a result, no WordPress plugin (including ours) is able to do anything with the final result…
This is a huge problem for us, because we need to add our tracking scripts in the resulting page, but we can’t: Leadpages’ WordPress plugin doesn’t offer any extension points for third-party plugins like ours to, well, extend/tweak/adapt their HTML.
One possible solution
I think I could implement a solution in which I tweak the HTML code returned by Leadpages so that it ends up including our tracking scripts… but it’s quite hacky. Not only do I need to add our scripts using “string-replace,” but also I’d need to either (a) tweak Leadpages’ plugin so that it has a filter that it currently doesn’t that allows me to modify the HTML it’s about to render (the best solution would be to ask their developers to officially add it) or (b) intercept the request they trigger to Leadpages’ server to retrieve the HTML and modify it right there. Extremely hacky!
But I’m wondering: does any of this make sense at all? As far as I know, Leadpages already has their own split testing solution, so why do you want to use our tool with theirs in the first place?