In order to better better match purchase events to Meta accounts - and therein improving ad delivery - I need to add Phone Number, email, first name and last name to purchase events in Shopify.
How would one go about this?
In order to better better match purchase events to Meta accounts - and therein improving ad delivery - I need to add Phone Number, email, first name and last name to purchase events in Shopify.
How would one go about this?
You need to add your script in the checkout (and thank you) page.
To do that you have a section under Settings -> Checkout -> Additional Scripts
In that part you can use the liquid variables. For example something like
window.dataLayer.push({
...
page_type: "purchase",
page_currency: "{{ shop.currency }}",
{% if customer %}
user_type: "member",
user_id: "{{ customer.id | remove: "'" | remove: '"' }}",
user_r: "{{ customer.last_order.created_at | date: "%B %d, %Y %I:%M%p" }}",
user_f: "{{ customer.orders_count }}",
user_m: "{{ customer.total_spent | times: 0.01 }}",
user_eh: "{{ customer.email | sha1 }}"
{% else %}
user_type: "visitor"
{% endif %}
});