Jump to content

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

Recommended Posts

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 comment
  • 3 months later...

 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 comment
  • 5 months later...
  • 2 weeks later...
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 comment
  • 10 months later...
On 12/4/2019 at 3:37 PM, LaHacienda said:

 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

Hello, 

Is the process not double counting your analytics? I am a little confused as GA tracking is a GTM tag. why is it stopping ecommerce data if its is the same thing? Why is GTM not allowing the ecommerce data?

Link to comment

There is a built-in integration to connect your site to Google Analytics. If you're using Google Analytics to track conversions for your eCommerce store, Squarespace should send the following information to Google Analytics for every received order:

  • Order ID
  • Your store name
  • Purchase total (includes shipping)
  • Customer's city, region, and country
  • Product name
  • SKU

If this isn't working for you, I suggest you read the support article Using Google Analytics with Squarespace and then contact Squarespace Customer Care if you need more help.

Edited by paul2009

About me: I'm Paul. A SQSP User for 18 yrs, I've been a Circle Leader since 2017. I value honesty, transparency, diversity and good design ♥.
Work: Founder of SF.DIGITAL, providing high quality original extensions to supercharge your Squarespace website. 
Content: Views and opinions are my own. Links in my posts may refer to my own SF.DIGITAL products or may be affiliate links.
Forum advice is free. You can thank me by clicking one of the feedback emojis below. Coffee fuels my work.

Book paid help with domains: Connect a GoDaddy domain. Connect a Squarespace Domain. Domain assistance

Link to comment
  • 2 years later...

Hey  @LianLim @ParadiseTechsoft @mafzal @jqarthur

it looks like y'all were having issues in Universal Analytics, but just in case you're having similar issues with GA4, I wanted to share the custom code and guide I created to track ecommerce on Squarespace sites using Google Tag Manager: https://www.tayloreddata.com/blog/how-to-track-ga4-ecommerce-events-on-your-squarespace-website

You can simply copy and paste the code into your own Google Tag Manager containers, just test and ensure it works for your website 🙂

Once I implemented this code, I'm able to measure how many people view my products, select a item, add to cart, remove from cart, begin checkout, and make a purchase in GA4:

Analytics_Purchasejourney-ga4.thumb.png.a95632a908c6e3908040609fecb75487.png

 

ecommerce-purchase-journey-ga4-exploration-report.thumb.png.78d3d8d061ff61ce02cf64c5f0122b4a.png

 

Let me know if you have any questions!

Edited by TayloredData

Data Nerd 🧑🏾‍💻|  I help businesses transform data into actionable insights & sales | Chat with me about your website + marketing analytics challenges: TayloredData.com

Prefer video tutorials? Check out my latest marketing and web analytics how to videos

Link to comment

Create an account or sign in to comment

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

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.