Google Trusted Stores Code for Footer and Checkout Page

This code is required by Google in your Footer, Checkout Page, for Google Trusted Stores. This article only provides the code needed for both areas. Other articles will be linked at the bottom of the page that will show you how to insert both codes.

Note: We don't directly support the code and the integration, we are providing this as a courtesy for our clients.

Applies to Version(s): 3.8.2r3 or Higher

Code that is required for the footer

Note: This code will be inserted into the footer.html

 

<!-- BEGIN: Google Trusted Stores -->
<script type="text/javascript">
var gts = gts || [];

gts.push(["id", "213150"]);
gts.push(["badge_position", "BOTTOM_RIGHT"]);
gts.push(["locale", '{$current_language.code}']);
gts.push(["google_base_offer_id", "ITEM_GOOGLE_SHOPPING_ID"]);
gts.push(["google_base_subaccount_id", "ITEM_GOOGLE_SHOPPING_ACCOUNT_ID"]);

{literal}
(function() {
var gts = document.createElement("script");
gts.type = "text/javascript";
gts.async = true;
gts.src = "https://www.googlecommerce.com/trustedstores/api/js";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(gts, s);
})();
{/literal}
</script>
<!-- END: Google Trusted Stores -->

Code that is required for the checkout (completed.html)

Note: This code will be inserted into the completed.html

 

<!-- 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_num}</span>
<span id="gts-o-email">{$items[0].email}</span>
<span id="gts-o-country">{$items[0].country_name}</span>
<span id="gts-o-currency">{$current_currency.code}</span>
<span id="gts-o-total">{$order_total|string_format:"%.2f"}</span>
<span id="gts-o-discounts">{$items[0].discount_amount|string_format:"%.2f"}</span>
<span id="gts-o-shipping-total">{$items[0].shipping_amount|string_format:"%.2f"}</span>
<span id="gts-o-tax-total">{$items[0].tax_amount|string_format:"%.2f"}</span>
<!-- end order and merchant information -->

<!-- start repeated item specific information -->
<!-- item example: this area repeated for each item in the order -->
var items = {$items|json_encode};
	{foreach from=$items item="item"}
		<span class="gts-item">
		<span class="gts-i-name">{$item.product_name}</span>

		<span class="gts-i-price">{$item.price|string_format:"%.2f"}</span>
		<span class="gts-i-quantity">{$item.quantity}</span>
		<span class="gts-i-prodsearch-id">{if $item.attribute_sku != ''}{$item.attribute_sku|escape:"javascript"}{else}{$item.sku|escape:"javascript"}{/if}</span>
		<span class="gts-i-prodsearch-store-id">ITEM_GOOGLE_SHOPPING_ACCOUNT_ID</span>
		</span>
	{/foreach}	
<!-- end item 1 example -->
<!-- end repeated item specific information -->

</div>
<!-- END Google Trusted Stores Order -->

 

For further information on the variables and requirements for this code please refer to Google.

Links to Related Articles.

How to Add Code to my Thank You Page

How to Add a Chat Addon (This will show you how to edit the footer.html)

If you didn't get your question answered, please contact the Pinnacle Cart Support Team. To submit a ticket, go to the My Account drop-down menu at the top right of the admin area and select Support

Was this article helpful?
0 out of 0 found this helpful