Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • You can also use markdown to share your code. When using markdown your code will be automatically converted to BBCode. For help with markdown check out the markdown guide.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.


    To learn more about how to use our BBCode feature, please click here.

    Thank you, Code Forum.

JavaScript Woocommerce & Shopper Approved Integration

bfly03

New Coder
I am trying to integrate shopper approved into our site and I do not know what to do and their team is being difficult. I am using Google Tag Manager.
I am trying to dynamically input the Customer Name, Customer Email, and Order ID. I am sure I have to replace the ORDER123, John Doe, and [email protected] with the correct variable but I just do not know what that is. Any help would greatly be appreciated.

JavaScript:
<script type="text/javascript"> var sa_values = { "site":XXXXX, "token":"XXXXX", '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 > 1477399567000) saLoadScript("https://www.shopperapproved.com/thankyou/rate/29663.js?d=" + d.getTime()); else saLoadScript("//direct.shopperapproved.com/thankyou/rate/29663.js?d=" + d.getTime()); </script>

Thank you.
 
Are you trying to put this tag on your website, or inside of Tag Manager? If you're trying to place this script tag inside of Tag Manager, typically there's some code on the website that takes the dynamic values and puts them into the data layer so Tag Manager can grab them and pass them to your custom tag.

I am assuming this tag fires on your receipt page? Do you know if there are any data layer variables on the receipt page inserted by WooCommerce? You can check by going to your receipt page after a transaction, right clicking and selecting "view source" and searching for either "datalayer" or "tag manager". If you find the data layer code there, if you paste the bit from the view source with that code and surrounding lines here I might be able to walk you through some more setup in tag manager. If the code isn't on the receipt page, then that's something that will need to be added. I'm not familiar with WooCommerce so I don't know if there would be a setting for that in the plugin.
 
I am placing it in Tag Manager.
I will inquire about some code on the website that takes the dynamic values and puts them into the data layer so Tag Manager can grab them and pass them to your custom tag.

The code fires and the lightbox with the review questions fire correctly upon the thank you page of the site. The issue is it is not auto populating the customer data in to the text fields that it is supposed to.
 

New Threads

Buy us a coffee!

Back
Top Bottom