How to add a “How Did You Hear About Us” survey to WebJobs
This will go in the employer registration form, or both. For the siteowner to review the data, it should go in Smartway as well, under the Statistics section. If adding to the job seeker registration, just follow the same instructions, but use the jobseeker files in the engine/pages and smartway/conf directories.
Step 1
Make new fields in database (use phpmyadmin or a similar tool to make it really easy!)
- In jb_select_boxes table, make up a group name, such as “referral sources”. Insert a new data record for each referral source that you want to use. Indicate referral source as the group name. Use the name of the referral source you want to track (i.e. Google) for the name field. The relative order indicates the order in which you want the names to appear in the dropdown list. 1 is on top, 2 is next, etc.
- In jb_users table, add a new field called referrals - varchar (128), null — to store the data that users choose on their registration form.
Step 2
Edit the php files to pull these new fields.
- In engine/pages/register_employer.php — around line 148, insert this line, in between ’signup_time” and ‘timezone” lines.
‘referrals’ => $sql->escape_string($input[’referrals’]),
Around line 154, add referrals into array. It should look something like this:
array(’login’, ‘password’, ’status’, ’salutation’, ‘first_name’,'middle_initial’, ‘last_name’,
’suffix’, ’suffix_titles’, ‘company_name’, ‘completed’, ’signup_time’, ‘referrals’, ‘timezone’, ‘language’));
Step 3
Edit the xml files to display the new fields on the form.
- In smartway/conf/register_employer.xml (or register_employer_city.xml or register_employer_both.xml, depending upon how you set up your configuration for displaying cities and states) , around line 12 change the “needselect” to include the referral sources.
<needselect from_table=”jb_select_boxes”><![CDATA[titles, suffixes, company types, referral sources]]></needselect>
- Add a new fieldset to display the dropdown box, such as
<fieldset legend=”Why did you decide to utilize our service? “>
<input name=”referrals” type=”select” required=”1″ group=”referral sources” store=”value” blankline=”" >(Select One)</input>
</fieldset>
Step 4
Add the data to smartway
- In smartway/modules/statistics.php, around line 46, add in this chunk:
$sql->query(’SELECT COUNT(*) FROM `jb_users` WHERE referrals = \’your referral source\”);
$f = $sql->fetch();
$sql->free_result();
$application->output[’your_referral_source‘] = util_funcs::number_format($f[0]);
$output = $application->output;
For each section, change the “WHERE company_type = \’your referral source\ ” to reflect the values you entered into the jb_select_boxes table. Change the output[’your_referral_source‘] to be reflective of these values, without any spaces or special characters. Copy and paste this code for each referral source.
- Near the bottom of the page, before the closing table tag (</table>) add table rows to display the referral source data. Replace the labels and $output to reflect your referral source values.
<tr>
<td width=\”50%\”><b><br>Referral Sources</b></td>
<td width=\”50%\”></td>
</tr>
<tr>
<td width=\”50%\”>Your Referral Source:</td>
<td width=\”50%\”>{$output[’your_referral_source‘]}</td>
</tr>
Repeat this part of the code
<tr>
<td width=\”50%\”>Your Referral Source:</td>
<td width=\”50%\”>{$output[’your_referral_source‘]}</td>
</tr>
as needed until all of your referral sources are displayed.
To see an example of this in action, visit the manufacturer registration page at Global Representation.
April 23rd, 2008 at 11:38 am
This is great! Thanks for posting it. I’m configuring webjobs for a client’s site and have found the modification process convoluted.
Do you have any suggestions for making the payment process and credits more streamlined? Thanks again