By Archie Bunker on
Looking to add Google Analytics tagging to the user regisration form on my Drupal site.
I want to add an "onblur" event to each form field so a page view is tracked for each field. This will help me determine how many fields users are filling out before quitting the process. Trying to set up a funnel/goal conversion.
Any help is greatly appreciated.
Tim
Comments
Use jquery
See here http://drupal.org/node/303754 for a similar problem.
That would give you something like this:
Which will fire if the focus leaves the user regsitration form.
I think people will be interested in what you come up with. Hope you will share it with the community.
This is untested code so prepare to debug...
HTH
Arie
follow up
interesting. don't know much about jquery or js. what I really am looking for is this based on the registration form at scanalytix.com/user/register/
User types in username and upon leaving the field the follow event happens: "onblur="pageTracker._trackPageview('/user/register/form/1-username.html')">
User types in email and upon leaving the field the follow event happens: "onblur="pageTracker._trackPageview('/user/register/form/2-email.html')">
User types in password and upon leaving the field the follow event happens: "onblur="pageTracker._trackPageview('/user/register/form/3-password.html')">
User types in confirm password and upon leaving the field the follow event happens: "onblur="pageTracker._trackPageview('/user/register/form/4-confirmpassword.html')">
......
and on and on...
If I use jquery as suggested, where do I place the code? Perhpas in the theme?
Yes the theme layer would do
More precisely in page-user-register.tpl.php since you only want the code on your page if the registration form is shown.
I think the site you refer to is using the google-analytics module http://drupal.org/project/google_analytics
Maybe you should just contact the web master of that site and ask them how they did it?
And finally you can always check the documentation on http://www.jquery.com
- Arie