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

Emit JS CustomEvent when a user subscribes to a ConvertKit Form #669

Merged
merged 2 commits into from
Nov 25, 2024

Conversation

n7studios
Copy link
Contributor

Summary

Inspired by this PR, emits a CustomEvent when a user subscribes to a ConvertKit Form.

This is handy to have so other plugins, can listen to, and we can use it in our current ongoing integration for custom event tracking.

Use document.addEventListener( 'convertkit_user_subscribed', function( event ) { console.log( event ); } ); to capture the event:

Screenshot 2024-05-31 at 12 55 32

Testing

Existing tests pass.

Checklist

@n7studios n7studios self-assigned this May 31, 2024
@@ -181,13 +181,24 @@ function convertStoreSubscriberEmailAsIDInCookie( emailAddress ) {
if ( convertkit.debug ) {
console.log( response );
}

return response.json();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noticed that this was missing, and as a result would mean the result in the next .then block would be null.

@n7studios n7studios requested review from a team, noelherrick and jenessawhite and removed request for a team November 21, 2024 00:22
@n7studios n7studios marked this pull request as ready for review November 21, 2024 00:22
@n7studios n7studios merged commit 2730e8f into main Nov 25, 2024
77 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants