type:
integration
supports-foxycart-version-from:
2.0
system:
Google Trusted Stores
name:
Google Trusted Stores
description:
Code for your receipt template to tell Google Trusted Stores about the purchase
date:
2014-09-19
version:
1.0
developer:
http://www.sparkweb.net

Google Trusted Stores

Please note: The code on this page is submitted by members of the FoxyCart community, and may not verified by FoxyCart.com LLC in any way, shape, or form. Please double check the code before installing. If you need help with it please post in our forum, but if we cannot offer assistance (due to unfamiliarity with this particular system or language) we apologize in advance.

Description

The Google Trusted Stores program is a trust-based program that monitors your purchases and pings a feed on your website for details on when your orders ship. To use this program, you need to add some code to your receipt as well as host a feed that details your shipment activity.

Installation

This assumes FoxyCart 2.0+. Your receipt must be a secure url. Place the following code in your receipt template and change the ID and domain fields to match your website.

Code

<!-- BEGIN: Google Trusted Stores -->
 
<script type="text/javascript">
  var gts = gts || [];
 
  gts.push(["id", "YOUR-ID"]);
  gts.push(["locale", "en"]);
  gts.push(["google_base_subaccount_id", "YOUR-SUBACCOUNT-ID"]);
 
  (function() {
    var scheme = (("https:" == document.location.protocol) ? "https://" : "http://");
    var gts = document.createElement("script");
    gts.type = "text/javascript";
    gts.async = true;
    gts.src = scheme + "www.googlecommerce.com/trustedstores/gtmp_compiled.js";
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(gts, s);
  })();
</script>
<!-- END: Google Trusted Stores -->
 
<!-- START Google Trusted Stores Order -->
<div id="gts-order" style="display:none;" translate="no">
 
	<!-- start order and merchant information -->
	<span id="gts-o-id">{{ order_id }}</span>
	<span id="gts-o-domain">YOURDOMAINHERE</span>
	<span id="gts-o-email">{{ customer_email }}</span>
	<span id="gts-o-country">{{ shipping_address.country_name }}</span>
	<span id="gts-o-currency">USD</span>
	<span id="gts-o-total">{{ total_order }}</span>
	<span id="gts-o-discounts">{{ total_discount }}</span>
	<span id="gts-o-shipping-total">{{ total_shipping }}</span>
	<span id="gts-o-tax-total">{{ total_tax }}</span>
	<span id="gts-o-est-ship-date">{{ "now"|date_modify("+1 days")|date("Y-m-d") }}</span>
	<span id="gts-o-est-delivery-date">{{ "now"|date_modify("+3 days")|date("Y-m-d") }}</span>
	<span id="gts-o-has-preorder">N</span>
	<span id="gts-o-has-digital">N</span>
	<!-- end order and merchant information -->
 
	{% for item in items %}
	<span class="gts-item">
		<span class="gts-i-name">{{ item.name }}</span>
		<span class="gts-i-price">{{ item.price_each|replace({"$": "", ",": ""}) }}</span>
		<span class="gts-i-quantity">{{ item.quantity }}</span>
	</span>
	{% endfor %}
 
</div>
<!-- END Google Trusted Stores Order -->

Site Tools