Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some form integrations are calling both AJAX and PHP submission handlers #887

Closed
fpcorso opened this issue Oct 14, 2020 · 2 comments · Fixed by #889
Closed

Some form integrations are calling both AJAX and PHP submission handlers #887

fpcorso opened this issue Oct 14, 2020 · 2 comments · Fixed by #889
Labels
Milestone

Comments

@fpcorso
Copy link
Contributor

fpcorso commented Oct 14, 2020

Describe the bug

Some of our form integrations, including CF7 and WPForms, are calling both our AJAX and PHP submission handlers resulting in duplicate processes for cookie creation and conversion counts.

Site information

Popup Maker version: 1.12.0
WordPress version: 5.5.1
PHP version: 7.4.1

Proposed Solution

We should have a method in the abstract form integration class that will check if it's an AJAX or REST call. We then use that method within each form integration to determine if we should process the form submission.

@fpcorso fpcorso added this to the v1.13 milestone Oct 14, 2020
@danieliser
Copy link
Member

I think the best option here is to add an extra value to the pum_vars and then use that to bypass a beacon hits.

@fpcorso
Copy link
Contributor Author

fpcorso commented Oct 15, 2020

@danieliser I think you confused this issue with the other one relating to PHP submission sending data to the front-end, which has already been resolved.

This would not be solved by any pum_vars as the AJAX request happens first. Remember, in our Slack thread, I explained that some of the form integrations call both submission handlers when submitted via AJAX. Refer to our thread here: https://app.slack.com/client/T1Q9SV610/GP01LEMM1/thread/GP01LEMM1-1602605298.007200

So, during the form submission, it currently goes:

  1. User clicks submit
  2. JS fires form success, which creates cookie and fires conversion counter
  3. PHP process form submission, firing our form success method, which creates cookie and fires conversion counter

The solution that you proposed in Slack is the one I listed in this issue.

fpcorso added a commit that referenced this issue Oct 19, 2020
…mine if we should process the submission

Since we repeat the same code for getting the popup ID and for increasing the conversion in all integrations, we should also move that here in case we need to change how that works in the future.

Issue #887
@fpcorso fpcorso linked a pull request Oct 19, 2020 that will close this issue
11 tasks
@fpcorso fpcorso closed this as completed Oct 19, 2020
@fpcorso fpcorso mentioned this issue Oct 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants