Help passing order data to fullstory.com

Shopify Partner
156 2 67

Hi There,

Very green when it comes to this so not 100% sure I'm doing this right. Basically, if there's an order, I'd like to pass the data to FullStory: https://help.fullstory.com/develop-js/setuservars

Here's where I'm at...

{% if order == true %}
    FS.setUserVars({
        "displayName" : "{{order.customer}}",
        "email" : "{{order.email}}",
        "orderNumber" : "{{ order.order_number }}",
        "orderTotal" : "{{ order.total_price | money_with_currency }}",
        "orderProducts" : "{{order.line_items}}"
        {% if customer.orders_count >= 1 %}
            "lifetimeTotal" : "{{ customer.total_spent | money_with_currency }}, {{customer.orders_count}} Total Orders",
        {% endif %}
    });
{% endif %}

Is that how to check if there's been an order?

Or do I insert this into a thank you page somewhere and not bother checking if there's been an order?

Any pointers in the right direction would be much appreciated.

Cheers

Ben

0 Likes
New Member
2 0 0

Hi Ben! I'm a FullStorian with a few pointers for you, but for the most comprehensive troubleshooting, you should give support@fullstory.com a holler with your snippet. But here's a few items to try in the meantime:

  1. Your custom variables need type suffixes, e.g. orderNumber_int, orderItems_str
  2. If {% if customer.orders_count >= 1 %} resolves to true, then the entire call will be invalid JavaScript because "orderProducts" : "{{order.line_items}}" doesn’t have a comma at the end of the line

Give these a try and if your user variables still aren't populating, please write us for more help at our support email address and we'll get right back to you!

- Caitlin

0 Likes
Shopify Partner
156 2 67

Thank you so much Caitlin, much appreciated.

I've ammended the snippet based on your corrections, does this look better?

{% if order == true %}
    FS.setUserVars({
        "displayName" : "{{order.customer}}",
        "email" : "{{order.email}}",
        {% if customer.orders_count >= 1 %}
            "lifetimeTotal_str" : "{{ customer.total_spent | money_with_currency }}, {{customer.orders_count}} Total Orders",
        {% endif %}
        "orderNumber_int" : "{{ order.order_number }}",
        "orderTotal_str" : "{{ order.total_price | money_with_currency }}",
        "orderItems_str" : "{{order.line_items}}"
    });
{% endif %}

Also, do you understand liquid? Or could someone help with some liquid questions?

1. Is this how to check if there's been an order?

{% if order == true %}

2. Or do I just insert the snippet into a thank you page and not check if there's been an order?

Any pointers would be much appreciated.

Cheers

Ben

0 Likes
New Member
2 0 0

Alas, I don't have any experience with Liquid so I wouldn't want to venture and give you a bad answer. Do you mind asking your question to support@fullstory.com? Our Huggers will be able to direct your question to an engineer who has more hands-on experience with Shopify. Thanks!

0 Likes
New Member
5 0 0

Hey Ben!

 

Have you maybe solved this? It would be amazing to know in Fullstory who the users are so you get a better idea of the customer and their interaction.

Would really really appreciate anything on this ;)

 

Have an amazing day :)

Br, Ziga

0 Likes