Difference between revisions of "Setting up Yotpo Mail After Purchase"
From Spiffy Stores Knowledge Base
Line 27: | Line 27: | ||
To send order data to Yotpo, you'll need to generate a user token (UTOKEN). Yotpo documentation on how to do this can be found at https://core-api.yotpo.com/v1.0/reference#about-authentication | To send order data to Yotpo, you'll need to generate a user token (UTOKEN). Yotpo documentation on how to do this can be found at https://core-api.yotpo.com/v1.0/reference#about-authentication | ||
− | Once you have your user token, copy the code snippet below, and paste it into the "xxx" filed on the Preferences -> Checkout & Payment section of your store's admin. You'll need to update the code with your Yotpo App Key and your | + | Once you have your user token, copy the code snippet below, and paste it into the "xxx" filed on the Preferences -> Checkout & Payment section of your store's admin. You'll need to update the APPKEY and UTOKEN in the code with your Yotpo App Key and your Yotpo User Token.<br><br> |
<pre> | <pre> | ||
Line 37: | Line 37: | ||
var data = JSON.stringify({ | var data = JSON.stringify({ | ||
"platform": "general", | "platform": "general", | ||
− | "utoken": " | + | "utoken": "<UTOKEN>", |
"email": "{{ customer.email }}", | "email": "{{ customer.email }}", | ||
"customer_name": "{{ customer.first_name }}", | "customer_name": "{{ customer.first_name }}", | ||
Line 54: | Line 54: | ||
var xhr = new XMLHttpRequest(); | var xhr = new XMLHttpRequest(); | ||
− | var url = "https://api.yotpo.com/apps/ | + | var url = "https://api.yotpo.com/apps/<APPKEY>/purchases/"; |
xhr.open("POST", url, true); | xhr.open("POST", url, true); | ||
xhr.setRequestHeader("Content-Type", "application/json"); | xhr.setRequestHeader("Content-Type", "application/json"); | ||
Line 71: | Line 71: | ||
<! -- End Yotpo mail after purchase --> | <! -- End Yotpo mail after purchase --> | ||
</pre> | </pre> | ||
+ | |||
+ | <br><br> |
Revision as of 14:17, 12 May 2021
If you've already added the Yotpo Reviews Widget, you now have the option of adding the Mail After Purchase function. This process takes a few steps, but the benefit from this is that you can collect reviews to display in your store automatically, rather than emailing your customers manually or using a service like MailChimp to email your customers.
The setup cost of the Yotpo Mail After Purchase function is a one-off fee of $35 AUD. To have us set it up for you, please email us with the following information...
- The email address and password you use to log in to Yotpo. They need to be for the xxx of the Yotpo account, as we cannot generate keys without admin access.
- Your Yotpo App Key and Secret Key
- Your St0roe's name
Retrieving your Yotpo App Key and Secret Key
App Key
- Log in to your Yotpo Dashboard
- Hover over the person icon in the top right, and click "Settings".
- Scroll down to the bottom of the page and copy your APP Key
- Paste your App Key into the email you send us.
Secret Key
- To retrieve your secret key, you'll need to click the "Get Secret Key" button.
- A link will be sent to you with a code
- Paster the code from the email into the "Enter the code" box
- Your Secret key will now be displayed.
- Paste your Secret Key into the email you send us.
When you have all the info we need, please email us with this info, and request that we add the conversion code to your store for you
Want to do it yourself?
To send order data to Yotpo, you'll need to generate a user token (UTOKEN). Yotpo documentation on how to do this can be found at https://core-api.yotpo.com/v1.0/reference#about-authentication
Once you have your user token, copy the code snippet below, and paste it into the "xxx" filed on the Preferences -> Checkout & Payment section of your store's admin. You'll need to update the APPKEY and UTOKEN in the code with your Yotpo App Key and your Yotpo User Token.
<! -- Yotpo mail after purchase --> <script> $(document).ready(function(){ var data = JSON.stringify({ "platform": "general", "utoken": "<UTOKEN>", "email": "{{ customer.email }}", "customer_name": "{{ customer.first_name }}", "order_id": "{{ order_name }}", "order_date": "{{ order_date | date: "%Y-%m-%d" }}", "currency_iso": "{{ shop.currency }}", "products": {% for item in line_items %}{ "{{ item.sku }}": { "url": "{{ item.product.url }}", "name": "{{ item.title }}", "image": "{{ item | img_url: '2048x2048' }}", "price": "{{ item.price | money_without_currency }}" }{% unless forloop.last %},{% endunless %}{% endfor %} } }); var xhr = new XMLHttpRequest(); var url = "https://api.yotpo.com/apps/<APPKEY>/purchases/"; xhr.open("POST", url, true); xhr.setRequestHeader("Content-Type", "application/json"); xhr.onreadystatechange = function () { if (xhr.readyState === 4 && xhr.status === 200) { var json = JSON.parse(xhr.responseText); console.log(json); } }; xhr.send(data); }); </script> <! -- End Yotpo mail after purchase -->