Uploaded image for project: 'Blesta Core'
  1. Blesta Core
  2. CORE-2583

Order: Add ability to save embed code to order forms for conversion data collection.

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 4.2.0
    • Fix Version/s: 4.3.0-b1
    • Component/s: None
    • Labels:
      None

      Description

      Under Packages > Order Forms > Settings

      1. Create a new section called Embed Code
      2. In that section, create a new textarea field labeled Order Form Embed Code
        • The textarea field will be parsable via H2o, so it should be validated to be parsable when saving it, similar to email templates
      3. Allow for the following tags (NOTE: SEE BELOW FOR AVAILABLE TAGS)
        • {order} – (include order.id and order.number in the Tags section)
        • {package} – (include package.id and package.name in the Tags section)
        • {package_group} – (include package_group.id and package_group.name in the Tags section)
        • {total} – (the total price. This may be better as a {totals} object with references to {totals.subtotal}, {totals.total_after_tax}, etc., if available)
        • {currency} – (the invoice/payment currency for the order)
      4. Add an order_page tag to be used in conditional statements so that the embed code can be conditional by page
        • Available order_page's should be based on the pages currently available in the order process where the embed code could be set (typically NOT AJAX requests)
          • signup/index
          • main/index
          • main/packages
          • forms/index
          • config/index
          • config/preconfig
          • checkout/index
          • checkout/complete
          • cart/index
      5. The full list of order_page's and additional tags should be made known in the documentation.
        • Be sure to denote in the documentation what tag(s) are available to what order page(s). For example, the {order} tag is not available before the checkout process is complete
      6. Ensure that the embed code is set to every page it is defined for on every order form
        • The AJAX order form may not allow the embed code to be set for certain pages during checkout because much of it is loaded via AJAX

      EXAMPLE EMBED CODE

      {% if order_page == 'forms/index' %}
      <script type="text/javascript">
      $(document).ready(function() {
      console.log('this is the forms/index page!');
      });
      </script>
      {% endif %}
      

      AVAILABLE TAGS:

      • order_page (e.g. "main/index")
      • currency (e.g. "USD")
      • products - A numerically-indexed array containing each service product in the cart, or processed for the order
        • Each item contains the package and package_group. See below for an example

      AVAILABLE TAGS ONLY ON THE checkout/complete ORDER PAGE

      • order - This is an object representing the order that was placed. See below for an example
      • invoice - This is an object representing the invoice for the order that was placed. See below for an example

      Example set of tags available to the checkout/complete page:

          [order_page] => checkout/complete
          [order] => stdClass Object
              (
                  [id] => 302
                  [order_number] => 5aeb807f2b778
                  [order_form_id] => 13
                  [invoice_id] => 6918
                  [fraud_report] => {"distance":"0","countryMatch":"No","countryCode":"","freeMail":"No","anonymousProxy":"No","score":"2.50","binMatch":"NA","binCountry":"","err":"IP_NOT_FOUND","proxyScore":"0.00","ip_region":"","ip_city":"","ip_latitude":"","ip_longitude":"","binName":"","ip_isp":"","ip_org":"","binNameMatch":"NA","binPhoneMatch":"NA","binPhone":"","custPhoneInBillingLoc":"NotFound","highRiskCountry":"No","queriesRemaining":"5935","cityPostalMatch":"No","shipCityPostalMatch":"","maxmindID":"9BHCJUNH","carderEmail":"No","riskScore":"9.24","explanation":"This order is slightly risky, and we suggest that you review it manually, especially for B2B transactions. The order is higher risk because the billing country and the country in which the IP address is located don't match"}
                  [fraud_status] => review
                  [status] => pending
                  [ip_address] => 127.0.0.1
                  [date_added] => 2018-05-03 21:34:55
                  [order_form_label] => umtemp
                  [order_form_name] => UM Temp
                  [client_id] => 1
                  [total] => 1.0000
                  [paid] => 0.0000
                  [currency] => USD
                  [date_closed] => 
                  [invoice_id_code] => PROFORMA-1-2018-05-03
                  [client_id_code] => 1500
                  [client_first_name] => Jar Jar
                  [client_last_name] => Binks
                  [client_company] => Republic Senate
                  [client_address1] => 1 Coruscant
                  [client_email] => tyson@phillipsdata.com
              )
      
          [invoice] => stdClass Object
              (
                  [id] => 6918
                  [id_format] => PROFORMA-{num}-2018-05-03
                  [id_value] => 1
                  [client_id] => 1
                  [date_billed] => 2018-05-03 21:34:55
                  [date_due] => 2018-05-03 21:34:55
                  [date_closed] => 
                  [date_autodebit] => 
                  [autodebit] => 1
                  [status] => proforma
                  [subtotal] => 1.0000
                  [total] => 1.0000
                  [paid] => 0.0000
                  [previous_due] => 16912.7368
                  [currency] => USD
                  [note_public] => 
                  [note_private] => 
                  [id_code] => PROFORMA-1-2018-05-03
                  [delivery_date_sent] => 
                  [due] => 1.0000
                  [line_items] => Array
                      (
                          [0] => stdClass Object
                              (
                                  [id] => 22424
                                  [invoice_id] => 6918
                                  [service_id] => 1106
                                  [description] => UM Temp -  (May 03, 2018 - Jun 03, 2018)
                                  [qty] => 1.0000
                                  [amount] => 1.0000
                                  [subtotal] => 1.00000000
                                  [taxes] => Array
                                      (
                                      )
      
                                  [taxes_applied] => Array
                                      (
                                      )
      
                                  [tax_subtotal] => 0
                                  [tax_total] => 0
                                  [total] => 1
                                  [total_w_tax] => 1
                              )
      
                      )
      
                  [delivery] => Array
                      (
                          [0] => stdClass Object
                              (
                                  [id] => 11050
                                  [invoice_id] => 6918
                                  [method] => email
                                  [date_sent] => 
                              )
      
                      )
      
                  [meta] => Array
                      (
                      )
      
                  [tax_subtotal] => 0
                  [tax_total] => 0
                  [taxes] => Array
                      (
                      )
      
              )
      
          [currency] => USD
          [products] => Array
              (
                  [0] => stdClass Object
                      (
                          [package] => stdClass Object
                              (
                                  [id] => 27
                                  [id_format] => {num}
                                  [id_value] => 24
                                  [module_id] => 1
                                  [name] => UM Temp
                                  [description] => 
                                  [description_html] => 
                                  [qty] => 
                                  [module_row] => 26
                                  [module_group] => 
                                  [taxable] => 0
                                  [single_term] => 0
                                  [status] => active
                                  [company_id] => 1
                                  [prorata_day] => 
                                  [prorata_cutoff] => 
                                  [id_code] => 24
                                  [email_content] => Array
                                      (
                                          [0] => stdClass Object
                                              (
                                                  [lang] => de_de
                                                  [html] => 
                                                  [text] => 
                                              )
      
                                          [1] => stdClass Object
                                              (
                                                  [lang] => en_us
                                                  [html] => 
                                                  [text] => 
                                              )
      
                                      )
      
                                  [pricing] => Array
                                      (
                                          [0] => stdClass Object
                                              (
                                                  [id] => 67
                                                  [pricing_id] => 249
                                                  [package_id] => 27
                                                  [term] => 1
                                                  [period] => month
                                                  [price] => 1.0000
                                                  [setup_fee] => 0.0000
                                                  [cancel_fee] => 0.0000
                                                  [currency] => USD
                                              )
      
                                      )
      
                                  [meta] => stdClass Object
                                      (
                                      )
      
                                  [groups] => Array
                                      (
                                          [0] => stdClass Object
                                              (
                                                  [id] => 35
                                                  [name] => Temp Group
                                                  [description] => 
                                                  [type] => standard
                                                  [company_id] => 1
                                                  [allow_upgrades] => 1
                                              )
      
                                      )
      
                                  [option_groups] => Array
                                      (
                                      )
      
                              )
      
                          [package_group] => stdClass Object
                              (
                                  [id] => 35
                                  [name] => Temp Group
                                  [description] => 
                                  [type] => standard
                                  [company_id] => 1
                                  [allow_upgrades] => 1
                              )
      
                      )
      
              )
      

      Google and other services allow tracking of conversion data by embedding a javascript snippet with variable substitution for certain values, like:

      • Order Number (And also Order ID)
      • Package Name
      • Package Group
      • Total Price
      • Quantity
      • Currency Code

      And possibly other variables. The best place for this embed code is probably under Packages > Order Forms > Settings with a section called "Embed Code" and a list of possible variables. The form should be a text area, and the contents of the text area should be embedded into the order form footer where other Javascript may appear.

        Issue Links

          Activity

          Hide
          tyson Tyson Phillips (Inactive) added a comment -

          So this is a field that allows embedding HTML as written? What page(s) will this be added to?

          What are all of the fields that are expected to be available for substitution?

          Show
          tyson Tyson Phillips (Inactive) added a comment - So this is a field that allows embedding HTML as written? What page(s) will this be added to? What are all of the fields that are expected to be available for substitution?
          Hide
          admin Paul Phillips added a comment -

          As written yes, with variable substitution. It sounds like we may need to have 2 fields, one for all order pages (including the order confirmation page), and one for the order confirmation page that a user sees only after a successful order has been completed.

          • General Tracking Embed Code (Appears on all order pages)
          • Conversion Tracking Embed Code (Appears on order completed page only)

          The variables mentioned in the task are sufficient for now.. but if during development other variables make sense to add, then they should be added.

          Show
          admin Paul Phillips added a comment - As written yes, with variable substitution. It sounds like we may need to have 2 fields, one for all order pages (including the order confirmation page), and one for the order confirmation page that a user sees only after a successful order has been completed. General Tracking Embed Code (Appears on all order pages) Conversion Tracking Embed Code (Appears on order completed page only) The variables mentioned in the task are sufficient for now.. but if during development other variables make sense to add, then they should be added.
          Hide
          tyson Tyson Phillips (Inactive) added a comment -

          Embedding HTML in the footer is very generic but your name "General Tracking.." and "Conversion Tracking.." are more specific than the field implies. Wouldn't this be better as a "Footer embed code set on every page" and "Footer embed code set only on the order completion page". Or, define CRUD functionality for embed codes and allow the user to select a page from a set of predefined pages in which the embed code should be set.

          Also, if there is embed code on every page I don't see how we could offer any consistent tags. Each page is different, particularly with the AJAX templates that would not update the footer since it would only be loaded once. It may be useful to have conditional support via H2O like email templates, but if we go that route we could just have 1 embed code field shown on every page and they can define conditions for what to display.

          Show
          tyson Tyson Phillips (Inactive) added a comment - Embedding HTML in the footer is very generic but your name "General Tracking.." and "Conversion Tracking.." are more specific than the field implies. Wouldn't this be better as a "Footer embed code set on every page" and "Footer embed code set only on the order completion page". Or, define CRUD functionality for embed codes and allow the user to select a page from a set of predefined pages in which the embed code should be set. Also, if there is embed code on every page I don't see how we could offer any consistent tags. Each page is different, particularly with the AJAX templates that would not update the footer since it would only be loaded once. It may be useful to have conditional support via H2O like email templates, but if we go that route we could just have 1 embed code field shown on every page and they can define conditions for what to display.
          Hide
          admin Paul Phillips added a comment -

          The language doesn't matter, if "Footer embed code set on every page" and "Footer embed code set only on the order completion page" is better language, that's fine.

          Only the variables available to the page would be able to be used, we would just want to suppress any errors. In other words, if the variable doesn't exist, and it's used, don't throw an error.

          Conditionals would be interesting, that could work for different steps. The only problem I see is if those steps are loosely defined and can vary between different order forms.

          Show
          admin Paul Phillips added a comment - The language doesn't matter, if "Footer embed code set on every page" and "Footer embed code set only on the order completion page" is better language, that's fine. Only the variables available to the page would be able to be used, we would just want to suppress any errors. In other words, if the variable doesn't exist, and it's used, don't throw an error. Conditionals would be interesting, that could work for different steps. The only problem I see is if those steps are loosely defined and can vary between different order forms.

            People

            • Assignee:
              jonathan Jonathan Reissmueller
              Reporter:
              admin Paul Phillips
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                15/Jun/18

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 2 days, 5 hours, 27 minutes
                2d 5h 27m

                  Agile