Knowledge Base/Knowledge Base/Sign Up Forms

How Do I Display Subscribers' Names or Email Addresses On My Thank You Page?

AWeber - Matt H
posted this on July 11, 2012 02:15 PM

You can display subscribers' information on your thank you page after they fill out your form and the page they see after confirming their subscription. Here's how to do it:

  1. Follow the instructions to pass form data to your thank you and/or confirmation success pages.
  2.     
  3. Add some JavaScript to your thank you or confirmation success page so that you can display subscribers' names or other information where you want on your page.
       
    Enter the JavaScript located in the textbox below to your website in the <head> section of the web page:
       
       
    <script type="text/javascript">
     var formData = function() {  var query_string = (location.search) ? ((location.search.indexOf('#') != -1) ? location.search.substring(1, location.search.indexOf('#')) : location.search.substring(1)) : '';  
    var elements = [];  
    if(query_string) {     
        var pairs = query_string.split("&");     
        for(i in pairs) {     
            if (typeof pairs[i] == 'string') {           
                var tmp = pairs[i].split("=");           
                var queryKey = unescape(tmp[0]);           
                queryKey = (queryKey.charAt(0) == 'c') ? queryKey.replace(/\s/g, "_") : queryKey;   
                elements[queryKey] = unescape(tmp[1]);      
                 }    
           } 
     }  
    return {     
        display: function(key) {         
            if(elements[key]) {           
                 document.write(elements[key]);         
             } 
             else {         
                   document.write("<!--If desired, replace everything between these quotes with a default in case there is no data in the query string.-->");          
              }     
      }   
    } 
    }
    (); </script>
                 
  4.    
  5. Wherever on the page you want to display your subscriber's information, open your web page's HTML and enter:

    <script type="text/javascript">formData.display("name")</script> - to display their name

    <script type="text/javascript">formData.display("email")</script> - to display their email

    <script type="text/javascript">formData.display("custom_fieldname")</script> - to display a custom field.

    For example, the custom field "phone" would be displayed using:

    <script type="text/javascript">formData.display("custom_phone")</script>
  6. If you are using our split name field in your web form, you can choose to display the first or last names using:

    <script type="text/javascript">formData.display("name (awf_first)")</script> - to display their first name

    <script type="text/javascript">formData.display("name (awf_last)")</script> - to display their last name

    Note that the first/last name fields will only be available for thank you pages. On your confirmation page, you can use the normal name field.
 
Topic is closed for comments