Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Advanced Search
  • 1

How to add Enhanced Ecommerce (ec) Plugin to squarespace?


ParadiseTechsoft

Question

Hi I am using squarespace for ecommerce. I already added google analytics to my website but want to add google analytics enhanced ecommerce plugin. Can you please tell me how to configurre enhanced eCommerce with squarespace.Here You can see I've tried adding enhanced ecommerce by following instructions on blog but I am unable to find correct data in google analytics report.Please have a look to my script in Code Injection-> "ORDER CONFIRMATION PAGE" (before this I have added Google analytics tracking code in(Setting->Advanced->External API Keys) See attached Enhanced ecommerce report:


<script>
       ga('create', 'UA-105393502-1', 'auto');
       ga('require', 'ec');
       ga('send', 'pageview');
       ga('ec:addImpression', {            // Provide product details in an impressionFieldObject.
         'id': '{orderId}',                   // Product ID (string).
         'name': '{ProductName}', // Product name (string).
         'category': '{ProductCategory}',   // Product category (string).
         'brand': '{ProductBrand}',                // Product brand (string).
         'variant': '{variant}',               // Product variant (string).
         'list': '',         // Product list (string).
         'dimension1': ''            // Custom dimension (string).
       });
         ga('ec:addProduct', {               // Provide product details in a productFieldObject.
         'id': '{orderId}',                   // Product ID (string).
         'name': '{ProductName}', // Product name (string).
         'category': '{ProductCategory}',   // Product category (string).
         'brand': '{ProductBrand}',                // Product brand (string).
         'variant': '{variant}',               // Product variant (string).
         'list': '',         // Product list (string).
         'dimension1': ''            // Custom dimension (string).
       });
       ga('ec:setAction', 'click', {       // click action.
         'list': 'Search Results'          // Product list (string).
         ga('send', 'pageview');
       });
       // The impression from a Related Products section.
       ga('ec:addImpression', {            // Provide product details in an impressionFieldObject.
         'id': '{orderId}',                   // Product ID (string).
         'name': '{ProductName}', // Product name (string).
         'category': '{ProductCategory}',   // Product category (string).
         'brand': '{ProductBrand}',                // Product brand (string).
         'variant': '{variant}',               // Product variant (string).
         'list': '',         // Product list (string).
         'dimension1': ''            // Custom dimension (string).
       });

         ga('ec:addProduct', {               // Provide product details in an productFieldObject.
         'id': '{orderId}',                  // Product ID (string).
         'name': '{ProductName}', // Product name (string).
         'category': '',            // Product category (string).
         'brand': '',                // Product brand (string).
         'variant': '',               // Product variant (string).
         'price': '',                 // Product price (number).
         'coupon': '',          // Product coupon (string).
         'quantity': 1                     // Product quantity (number).
       });

       ga('ec:setAction', 'purchase', {          // Transaction details are provided in an actionFieldObject.
          'id': '{orderId}',                  // (Required) Transaction id (string).
         'affiliation': '', // Affiliation (string).
         'revenue': '',                     // Revenue (number).
         'tax': '',                          // Tax (number).
         'shipping': '',                     // Shipping (number).
         'coupon': ''                  // Transaction coupon (string).
       });// Refund an entire transaction.
       ga('ec:setAction', 'refund', {
         'id': '{orderId}',// Transaction ID is only required field for full refund.
       });

         // 1. Send product and impression data with pageview.

       ga('ec:addProduct', {
         'id': '{orderId}',                   // Product ID (string).
         'name': '{ProductName}', // Product name (string).
         'category': '',            // Product category (string).
         'brand': '',                // Product brand (string).
         'variant': '',               // Product variant (string).
       });

       // The impression from the Related Products section.
       ga('ec:addImpression', {
         'id': '{orderId}',                   // Product ID (string).
         'name': '{ProductName}', // Product name (string).
         'category': ' '   // Product category (string).
         'brand': '',                // Product brand (string).
         'variant': '',               // Product variant (string).
         'list': '',       // Product list (string).

       });
       ga('ec:setAction', 'detail');       // Detail action.
       ga('send', 'pageview');             // Send the product data with initial pageview.


       // 2. Send the promo click data when the promo click occurs.

       // Call this function when promo click occurs.
       function onPromoClick() {
         ga('ec:addPromo', {
          'id': '{orderId}',                   // Product ID (string).
         'name': '{ProductName}', // Product name (string).
          'creative': '',
           'position': ''
         });

         // Send the promo_click action with an event.
         ga('ec:setAction', 'promo_click');
         ga('send', 'event', '', 'click', '');
       }// Called when a link to a product is clicked.
       function onProductClick() {
         ga('ec:addProduct', {
       'id': '{orderId}',                   // Product ID (string).
         'name': '{ProductName}', // Product name (string).
           'category': '',
           'brand': '',
           'variant': '',

         });
         ga('ec:setAction', 'click', {list: 'Search Results'});

         // Send click with an event, then send user to product page.
         ga('send', 'event', 'UX', 'click', 'Results', {
           hitCallback: function() {
             document.location = '/product_details?id=P12345';
           }
         });
       }
         // Called when a product is added to a shopping cart.
       function addToCart(product) {
         ga('ec:addProduct', {
           'id': product.id,
           'name': product.name,
           'category': product.category,
           'brand': product.brand,
           'variant': product.variant,
           'price': product.price,
           'quantity': product.qty
         });
         ga('ec:setAction', 'add');
         ga('send', 'event', 'UX', 'click', 'add to cart');     // Send data using an event.
       }







data.png.89d80b95178e4b1d5a15b2ee0e05a82e.png

data-2.png.e589363c282e9cae59951c4bf36219e5.png

Edited by ParadiseTechsoft
Initial Revision
Link to post
  • Answers 3
  • Created
  • Last Reply

Top Posters For This Question

3 answers to this question

Recommended Posts

  • 0

 Hello, 

That's right, Squarespace does not support GTM implementation on their sites and therefore this is not supported on their checkout process, even if you're checking out users on your own domain, there's no control over what happens in the backend of that checkout page. 

However, we've found a workaround for this issue which works perfectly for us. 

So, the idea behind having Google Tag Manager on the site is so that you can track specific actions that you can't track by simply using Google Analytics - I take it that this is why you're also using GTM. 

One of the first steps we take whenever setting up GTM is to setup a "page view" tag to send this data into Analytics, which I assume you've also done. 

We also know that Squarespace and eCommerce tracking through GTM doesn't work, HOWEVER, eCommerce tracking through Google Analytics IS SUPPORTED by Squarespace (by adding the ID code within the web settings) so, the solution here is to use a combined approach by doing some of the tracking through GTM and some of it through the out of the box tracking with Squarespace and Google Analytics. 

Follow these rough steps (I'm assuming you've got experience with GTM and that you've already done some of the implementation):

- Add your analytics tracking code to Squarespace settings
- Enable eCommerce tracking and enhanced eCommerce settings within your Google Analytics view
- Go to your GTM container and PAUSE the tag that's sending "Page View" data into Google Analytics
- Voila! 🙂 

This way, Squarespace will take care of sending Page View and eCommerce data into your Google Analytics and you can do all of your behavioural tracking (button clicks, scrolling, Facebook Pixel, etc) within your GTM container. 

I hope that's clear enough and that it works for you. Let me know if it does! 🙂 

All the best,
Mariano

Link to post
  • 0
Posted (edited)

@ParadiseTechsoft
@LaHacienda
How did you get e-commerce working with Google Analytics? Do you just install the tracking code: UA-XXXXXXXX-Y into Settings > Advanced > External API Keys  

Do we need to add anything into Settings > Advanced > Code Injection ??


Mines not working ... 😞

Edited by LianLim
tagging another member
Link to post
  • 0
On 5/5/2020 at 10:38 AM, LianLim said:

@ParadiseTechsoft
@LaHacienda
How did you get e-commerce working with Google Analytics? Do you just install the tracking code: UA-XXXXXXXX-Y into Settings > Advanced > External API Keys  

Do we need to add anything into Settings > Advanced > Code Injection ??


Mines not working ... 😞

did you figure out the solution as at my side it's not working after enabling Enhanced E-Commerce at GA.

Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment


×
×
  • Create New...