WordPress.org

Ready to get started?Download WordPress

Forums

WordPress-to-lead for Salesforce CRM
Conversion Tracking Code Field (7 posts)

  1. KodeTom
    Member
    Posted 10 months ago #

    Hi,

    I'm using this plugin for a clients site and they would like to track conversions in Google Analytics, I'm trying to achieve this without using a thank you page by editing your plugin to have the option to enter a conversion code under the "Return/Thanks URL" within the settings area for a particular form.

    I've got the field to save and been able to output the code, only problem is that it will only save if the field is a <input type="text"> and not a <textarea> which is what I want.

    See what I've done here: http://postimg.org/image/ulods63rt/

    Any chance of a little help with this one?

    Thanks.

    Tom.

    http://wordpress.org/extend/plugins/salesforce-wordpress-to-lead/

  2. Nick Ciske
    Member
    Plugin Author

    Posted 10 months ago #

    Sorry, I can’t debug your code from an image... post a gist of your changes and I may be able to help.

  3. KodeTom
    Member
    Posted 10 months ago #

    Okay so for the conversion code I've added:

    Below "Return/Thanks URL:" in salesforce.php under line 469:

    $content .= '<p>';
    $content .= '<label>'.__('Conversion Code:','salesforce').'</label><br/>';
    $content .= '<input type="text" name="conversioncode" style="width:50%;" value="'.esc_html($options['forms'][$form_id]['conversioncode']).'">';
    
    $content .= '<br/><small>'.__('Code to track conversions').'</small>';
    
    $content .= '</p>';

    And then under $dform['returl'] = ''; on line 553:
    $dform['conversioncode'] = '';

    And then under 'returl's foreach this starts on line 120:

    foreach (array('form_name','source','conversioncode') as $option_name) {
    						if (isset($_POST[$option_name])) {
    							$options['forms'][$form_id][$option_name] = $_POST[$option_name];
    						}
    					}

    You can see the input field is input type="text" in the first bit of code i pasted, I want this to save as a textarea instead but when I change the field to a textarea it won't save.

    Any thoughts?

  4. Nick Ciske
    Member
    Plugin Author

    Posted 10 months ago #

    Looks fine to me... not sure why it's not saving...

    Are you sure it's not saving -- or it is just not displaying correctly when you pull it back out (e.g. is it there in the DB, or it never makes it to the DB)?

    e.g. are you using esc_textarea instead of esc_html? And outputting it between the tags vs. in the value?

    Perhaps your code is getting sanitized somewhere before it hits the DB? It's been awhile since I touched that particular code...

  5. KodeTom
    Member
    Posted 10 months ago #

    Yeah that does work fine, the only issue is that I want to change the input type=text to a textarea instead so I can echo the conversion code properly.

  6. KodeTom
    Member
    Posted 10 months ago #

    When I change it to a textarea it doesn't save

  7. Nick Ciske
    Member
    Plugin Author

    Posted 10 months ago #

    Post the textarea version of the code, I'm thinking that's where the issue lies.

Reply

You must log in to post.

About this Plugin

About this Topic