• Resolved bvanskivertl

    (@bvanskivertl)


    I recently upgraded WooCommerce to version 6.1.1 and noticed that the WooCommerce Conversion Tracking is no longer replacing some fields in a custom script.

    The problem fields are {customer_first_name}, {customer_last_name}, and {customer_email}. {order_number} and {order_total} work as expected. An example of my script is below.

    <script type="text/javascript">
      window.rrSpace = (
        rrSettingsConversion = {
          debug: "false",
          parameters: {
            firstname: "{customer_first_name}",
            lastname: "{customer_last_name}",
            email: "{customer_email}",          
            externalidentifier: "{order_number}",
            amount: "{order_total}"
          }
        }
      );
      (function (f, r, n, d, b, y) { b = f.createElement(r), y = f.getElementsByTagName(r)[0]; b.async = 1; b.src = n; b.id = 'RR_DIVID'; y.parentNode.insertBefore(b, y); })(document, 'script', '//example.referralrock.com/webpixel/beta/universalv03.js');
    </script>

    On ReferralRock these come through like this:

    "ReceivingURLParams": {
        "firstname": "{customer_first_name}",
        "lastname": "{customer_last_name}",
        "email": "{customer_email}",
        "externalidentifier": "53855",
        "amount": "280.90"
      },
Viewing 1 replies (of 1 total)
  • Thread Starter bvanskivertl

    (@bvanskivertl)

    I found the issue, the problem was a difference between the 2.0.8 and 2.0.9 versions of the WooCommerce Conversion Tracking plugin. The 2.0.9 version only replaces the {customer_*} details for custom scripts if the user is logged in whereas the 2.0.8 version pulls the customer details from the order. In our system we only use guest checkout so we never have a logged in user for orders.

    The following are samples from the /includes/integrations/class-integration-custom.php file. In both cases $customer is equal to $order->get_user()

    2.0.8:

     // customer details
    /* ORIGINAL CUSTOMER DETAIL CODE
      if ( $customer ) {
          $code = str_replace( '{customer_id}', $customer->ID, $code );
          $code = str_replace( '{customer_email}', $customer->user_email, $code );
          $code = str_replace( '{customer_first_name}', $customer->first_name, $code );
          $code = str_replace( '{customer_last_name}', $customer->last_name, $code );
      }
    /* END ORIGINAL CODE */
    
    /* JON'S EXPERIMENTAL CUSTOMER DATA CODE */
    /* No User required */
      $code = str_replace( '{customer_id}', $order->get_customer_id(), $code );
      $code = str_replace( '{customer_email}', $order->get_billing_email(), $code );
      $code = str_replace( '{customer_first_name}', $order->get_billing_first_name(), $code);
      $code = str_replace( '{customer_last_name}', $order->get_billing_last_name(), $code );
    
    /* END EXPERIMENT */

    2.0.9:

    // customer details
    if ( $customer ) {
        $code = str_replace( '{customer_id}', $customer->ID, $code );
        $code = str_replace( '{customer_email}', $customer->user_email, $code );
        $code = str_replace( '{customer_first_name}', $customer->first_name, $code );
        $code = str_replace( '{customer_last_name}', $customer->last_name, $code );
    }

    Notice that 2.0.9 only works with a user since we lost “JON’S EXPERIMENTAL CUSTOMER DATA CODE”. We ended up reverting the plugin and it resolved our issue.

Viewing 1 replies (of 1 total)
  • The topic ‘Some tags not populating’ is closed to new replies.