Sales Technology Web Wordpress

Wufoo Form Referrer in WordPress Widgets

We were using a Wufoo form in a sidebar widget area on a WordPress theme to help with sales conversions. But then we wanted to know what page the user was looking at when they filled out the form. Below is all the information you’ll need to do just that.

The Wufoo blog has an informative overview of the general solution to tracking on wufoo. And Wufoo support team was very helpful by sharing this wufoo tracking tutorial with CSS. Those two links took me 90% there. Here are the extra details you’ll want to get it all to work in the WordPress widget area.

  1. Set things up as described in the links above.
  2. Install the PHP Text Widget plugin, which extends the text area widget to allow PHP within the text area (otherwise it won’t compile the code at runtime, and instead it would merely echo the PHP code within the widget). Please note, that once you install the plugin, there is nothing else to do — there is no settings page for the plugin or anything…the text area widget will now compile the php.
  3. You will want to add this code 'defaultValues':'fieldXXX=<?php the_permalink() ?/> ', to the wufoo form javascript code. This will autofill a field XXX with the URL that the user is viewing. Specifically, this code <?php the_permalink() ?/> will use PHP to return the current URL in wordpress.
  4. Finally, to find that field number XXX and replace it with the actual field number of your hidden refer field. To do this, in Wufoo admin tool, go the the form’s “code” area and click on the “API Information” button in the upper right corner. Than will show you the API ID of each field. Replace XXX in with your field’s number.

Now when somebody fills out your form, it should show the URL they were on when they filled out the form. Happy coding!