• 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: https://postimg.org/image/ulods63rt/

    Any chance of a little help with this one?

    Thanks.

    Tom.

    https://www.ads-software.com/extend/plugins/salesforce-wordpress-to-lead/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Nick Ciske

    (@nickciske)

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

    Thread Starter KodeTom

    (@kodetom)

    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?

    Plugin Author Nick Ciske

    (@nickciske)

    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…

    Thread Starter KodeTom

    (@kodetom)

    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.

    Thread Starter KodeTom

    (@kodetom)

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

    Plugin Author Nick Ciske

    (@nickciske)

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

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Conversion Tracking Code Field’ is closed to new replies.