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

Add an "onClick" field to submit button #109

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

robertseaton
Copy link

Hey, Brandon,

Love the plugin. I use it across a couple of different Wordpress installs -- great stuff, thanks!

I wanted to track clicks on different mailing list signup forms across the site, to see what is working and what isn't. The easiest way to do this was to use Google Events tracking via an onClick parameter. So I hacked together a version of the plugin that supports that.

Concretely:
screen shot 2014-09-12 at 11 35 42 pm

And this changes the generated HTML to this:

 <input value="Join Us" id="subbutton" onclick="ga('send', 'event', 'Button', 'OptIn', 'Sidebar - Top');" type="submit">

Not sure if this is something you're looking to add support for, but I figured I'd submit the pull request anyways. Oh, and my PHP skills are completely limited to what I've learned breaking WordPress, so, uh, buyer beware.

@GaryJones
Copy link
Contributor

-1 for adding obtrusive JavaScript. Having the plugin trigger a JS event (see #68) is a good thing, but forcing an event through HTML attributes should not be the way to go.

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