FD1 Client Protocol
 

Rate our Service example

Rate our service shows how you can email a customer a feedback request. They connect to a public static web page. That page then sends the feedback result to Fieldpine Ingest Server, where it eventually makes its way to the retailers server.

Step 1 - Landing Page

Design your landing page that customers will interact with.

Your landing webpage on your website
Preview
<style>
.userbutton {
    padding:0.5em;
    font-size:1.4em;
    font-weight:700;
}
</style>
<h1>Rate Our Service</h1>
<p>Thanks for your recent visit. We would love to know how we did</p>

<div style='text-align:center;margin-top:2em'>
<input type=button value="1
😬" class="userbutton" id=vote1 onclick='DoVote(1)' style='background-color:red;width:3.5em''> <input type=button value="2
🙁" class="userbutton" id=vote2 onclick='DoVote(2)' style='background-color:hotpink;width:3.5em''> <input type=button value="3
😐" class="userbutton" id=vote3 onclick='DoVote(3)' style='background-color:azure;width:3.5em''> <input type=button value="4
🙂" class="userbutton" id=vote4 onclick='DoVote(4)' style='background-color:lightgreen;width:3.5em''> <input type=button value="5
😀" class="userbutton" id=vote5 onclick='DoVote(5)' style='background-color:lime;width:3.5em'> </div> <script> function DoVote(N) { // Change this to be your real Ingest server address let srv = "https://demo.online.fieldpine.com/ingest/fd1.capture.capture_shopper_feedback"; // create an FD1 packet let packet = { a: "fd1.capture.capture_shopper_feedback", v: { vote: N } } // If the URL has a sale or other reference string // add that to the packet we store let queryargs = new URLSearchParams(window.location.search); const refSale = queryargs.get('id'); if ((refSale != undefined) && (refSale.length > 8)) packet.v.ref = refSale; // Send to your ingest server. This will store the data for later transmission to the "real" server // This fetch request is crafted to not require a CORS preflight // FD1 normally uses websockets, but the ingest server accepts unauthenticated POST requests // (but only for very safe APIs) fetch(srv, { method: "POST", headers: { "content-type": "text/plain" }, body: JSON.stringify(packet) }) for (let n=1; n <= 5; n++) document.getElementById("vote"+n).disabled = true; alert("Thanks for letting us know"); } </script>

Step 2 - Send Email to Customer

Email the customer the URL of the page you generated in Step 1.

The URL you send should include the query arg "id" with the sale id. This allows you to track the feedback to a specific store and sale

If you are using Fieldpine to create the email cover letter, something like the following can be put into the body template when the receipt is emailed to them

<p>How did we do?  Please spend a minute to 
    <a href="https://your-server.com/customer_feedback.htm?id=%data.activesale.physkey%">Rate our Performance</a>

If you do not include an "id", then customers can vote multiple times, or bad actors can enter thousands of false feedbacks. Sending the ID means we can discard all entries that do not have a valid id.

Or, Step 3 - Print a QR on the receipt

If you aren't emailing the customer and simply giving them a printed receipt, add a QR code to the receipt to take them to your feedback page.

The QR code still contains the sale id so you can still link feedback to a store.