Author Topic: help with google opt in code for reviews on website  (Read 1103 times)

dfumain

  • Beginner
  • *
  • Posts: 1
  • A beginner
help with google opt in code for reviews on website
« on: March 13, 2018, 22:41:41 pm »
hi all, this has been driving me mad for a good week now, and after looking at googles help and other messages on VM forum im still at a lose.

so im trying to add the google review code to my site, google says it need to be in the The confirmation page..

so ive been reading and after alot of reading. on here most people say it goes in the PHP of this file
components/com_virtuemart/views/cart/tmpl/order_done.php

i have full ftp access and can change all files.
i have added the code in the php and then tested on the site, it stops the cart from working,

my question is have i got some ID wrong

this is the code im adding

<script src="https://apis.google.com/js/platform.js?onload=renderOptIn" async defer></script>

<script>
  window.renderOptIn = function() {
    window.gapi.load('surveyoptin', function() {
      window.gapi.surveyoptin.render(
        {
          // REQUIRED FIELDS
          "merchant_id": (i know this number),
          "order_id": "ORDER_ID",
          "email": "CUSTOMER_EMAIL",
          "delivery_country": "COUNTRY_CODE",
          "estimated_delivery_date": "YYYY-MM-DD",

          // OPTIONAL FIELDS
          "products": [{"gtin":"GTIN1"}, {"gtin":"GTIN2"}]
        });
    });
  }
</script>

could the order_id be wrong? or any other ID wrong.

if anyone can help this would be great. or point me in the direction of somebody i can pay to help. we are in the UK

im using VM VirtueMart 3.2.12
Joomla! 3.8.5 Stable [ Amani ] 6-February-2018 15:00 GMT

i have full super user account
and the FTP account

im not willing to give out the details, as after reading VM forum some people have been left vulnerable

i can download and send the order php file, and any other files needed, and im quite good following step by step insturctions

please help thank you all

Ghost

  • Jr. Member
  • **
  • Posts: 408
Re: help with google opt in code for reviews on website
« Reply #1 on: March 14, 2018, 07:17:37 am »
You're saying the order ID could be wrong but you don't show how you get the ID?

Austin Walker

  • Readers
  • *
  • Posts: 0
  • Beginner
  • Skype Name: Austin W
Re: help with google opt in code for reviews on website
« Reply #2 on: March 14, 2018, 08:07:29 am »
--

dfumain

  • Beginner
  • *
  • Posts: 1
  • A beginner
Re: help with google opt in code for reviews on website
« Reply #3 on: March 14, 2018, 21:28:36 pm »
hi, im just taking it as ORDER_ID will be the same, in the virtual mart settings, or would this me called a different name, and thats what i have over looked

Ghost

  • Jr. Member
  • **
  • Posts: 408
Re: help with google opt in code for reviews on website
« Reply #4 on: March 15, 2018, 07:35:41 am »
ORDER_ID is nothing. It's a placeholder text. You're supposed to get the actual ID from VM. Same with other fields.

dfumain

  • Beginner
  • *
  • Posts: 1
  • A beginner
Re: help with google opt in code for reviews on website
« Reply #5 on: April 02, 2018, 12:30:27 pm »
can anyone help please? or point me in the right directions thanks

Jumbo!

  • 3rd party VirtueMart Developer
  • Full Member
  • *
  • Posts: 650
  • Full-stack Web Developer
    • www.virtueplanet.com
  • VirtueMart Version: Always latest
Re: help with google opt in code for reviews on website
« Reply #6 on: April 02, 2018, 15:35:06 pm »
components/com_virtuemart/views/cart/tmpl/order_done.php is not the final order confirmation page layout for all payment plugins. If you use hosted payment services like Authorize.net, Standard Payment etc then the order confirmation page is displayed using components/com_virtuemart/views/cart/tmpl/order_done.php But if you use any payment services like PayPal Standard, 2Checkout etc then the order confirmation is displayed using components/com_virtuemart/views/vmplg/tmpl/default.php

Most importantly, the contents displayed in these pages are controlled by the selected payment plugin. You do not have the actual order information in the layout files which you can pass to your opt-in tracking codes. Therefore you will have to override the respective payment plugin's order confirmation page layout to properly pass the order information to your opt-in tracking codes. For example, Standard Payment uses this layout file to print the order confirmation - plugins/vmpayment/standard/standard/tmpl/post_payment.php

We have developed a plugin to avoid this problem. It can easily add any kind of tracking/opt-in codes to the final order confirmation without getting into any kind of coding or layout overrides. You can take a look at VP Conversion Tracking plugin - https://www.virtueplanet.com/extensions/vp-conversion-tracking It will help you to easily setup the Google Opt In codes to your order confirmation page right from the plugin settings.