longhorn1999 Posted July 14, 2015 Share Posted July 14, 2015 Hi, I hadn't seen discussed anywhere in the forum, so hopefully this is right place for this question. I'm looking to add code to my checkout_success.php to allow for merchant reviews via a pop-up survey. I'm going to be using a paid service from Shopper Approved, mainly because they have some partnership with Google such that star ratings will eventually show up in PLAs and search results. The basic code for the pop-up that appears after a successful checkout is the following: <script type="text/javascript"> var sa_values = { "site":1XXXX }; function saLoadScript(src) { var js = window.document.createElement("script"); js.src = src; js.type = "text/javascript"; document.getElementsByTagName("head")[0].appendChild(js); } var d = new Date(); if (d.getTime() - 172800000 > 1436858212000) saLoadScript("//www.shopperapproved.com/thankyou/rate/1XXXX.js"); else saLoadScript("//direct.shopperapproved.com/thankyou/rate/1XXXX.js?d=" + d.getTime()); </script> I've replaced my unique site ID above with 1XXXX. But if I want to have the Order ID, the customer's name, and the customer's email populated into this survey, the code is some version of the following: <script type="text/javascript"> var sa_values = { 'site':1XXXX, 'orderid':'ORDER123', 'name':'John Doe', 'email':'[email protected]' }; function saLoadScript(src) { var js = window.document.createElement("script"); js.src = src; js.type = "text/javascript"; document.getElementsByTagName("head")[0].appendChild(js); } var d = new Date(); if (d.getTime() - 172800000 > 1436858212000) saLoadScript("//www.shopperapproved.com/thankyou/rate/1XXXX.js"); else saLoadScript("//direct.shopperapproved.com/thankyou/rate/1XXXX.js?d=" + d.getTime()); </script> Could someone show me how to populate this survey code with these customer customer attributes? Thanks! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.