{"id":14364,"date":"2023-10-25T17:54:24","date_gmt":"2023-10-25T14:54:24","guid":{"rendered":"http:\/\/localhost:8080\/how-to-implement-ecommerce-tracking-in-google-analytics\/"},"modified":"2023-10-25T17:54:24","modified_gmt":"2023-10-25T14:54:24","slug":"how-to-implement-ecommerce-tracking-in-google-analytics","status":"publish","type":"post","link":"https:\/\/alienroad.com\/how-to-implement-ecommerce-tracking-in-google-analytics\/","title":{"rendered":"How To Implement Ecommerce Tracking in Google Analytics"},"content":{"rendered":"<h2>How To Implement Ecommerce Tracking in Google Analytics<\/h2>\n<p>You&#8217;ve likely heard the term, but what exactly is e-commerce tracking? In short, it&#8217;s a feature on Google Analytics that allows you to track online transactions on e-commerce websites. It provides detailed analytical data to help establish the right path to maximum ROI.<\/p>\n<p>Ecommerce tracking even lets you see online traffic sources to improve your conversions. Doesn\u2019t that sound exciting? It\u2019s rather simple to enable your website for generating such information. All you need is a few extra codes. Of course, you also have to analyze the data presented to make the most of it.<\/p>\n<h2 id=\"E42\">Benefits of E-Commerce Tracking<\/h2>\n<p>Before understanding the benefits of tracking with Google Analytics, you must first be aware of the data that would become available. You&#8217;ll be able to study the:<\/p>\n<p>\u2022 Revenue generated by each of the products<br \/>\n\u2022 Total revenue<br \/>\n\u2022 Total number of products sold<br \/>\n\u2022 Quantity of specific products sold<br \/>\n\u2022 Rate of conversions<br \/>\n\u2022 Total transactions<br \/>\n\u2022 Number of unique purchases made<br \/>\n\u2022 Average price of products<br \/>\n\u2022 Average value of orders<br \/>\n\u2022 Date wise performance data<br \/>\n\u2022 Number of days and sessions leading to a transaction<\/p>\n<p>Using the above facts and figures, you can easily gauge which products are selling well and which are flopping.\u00a0Setting up e-commerce tracking\u00a0will give you valuable insight into the effectiveness of your marketing efforts.<\/p>\n<div>\n<div class=\"sc-9bf09c5b-0 dGnVIe sc-c0b7a5bc-0 drUuop\" data-test=\"ebooks-promo-widget\"><\/div>\n<\/div>\n<p>By knowing the exact revenue generated from each generation, you can get your sales in line with your expectations. For instance, if the revenue produced from each sale is less than you&#8217;ve been expecting, you could introduce discounts or set a minimum purchase clause.<\/p>\n<p>This Google Analytics feature helps you get to know your returning customer base. You can then plan your specific re-marketing strategies to target them and enhance conversions. Thus, using the tracking data can accomplish a lot.<\/p>\n<h2 id=\"E107\">How Are Transactions Tracked?<\/h2>\n<div>\n<div>\n<p>Let&#8217;s briefly look at the process depicted below to better understand how a transaction is tracked using Google Analytics.<\/p>\n<p><span class=\"b-blog__image\"><\/span><\/p>\n<p>Image credit:\u00a0<a href=\"http:\/\/www.optimizesmart.com\/\" target=\"_blank\" rel=\"noopener\">http:\/\/www.optimizesmart.com\/<\/a><\/p>\n<p>As you can see, the tracking involves:<\/p>\n<p>\u2022 Completion of a transaction by the visitor.<br \/>\n\u2022 Processing in your eCommerce platform. This includes verifying the mode of payment, storing transaction details, generating the receipt page, inserting the transaction date into tracking code and loading the receipt for customer viewing.<br \/>\n\u2022 For the visitor, the transaction is complete and he or she will await the product&#8217;s arrival. However, the moment the receipt loads on the customer\u2019s browser, the tracking code sends data to the Google Analytics Server.<\/p>\n<p>The receipt page is very important because it&#8217;s where you need to add the tracking code. Through this, Google Analytics receives data from the transaction and stores it with other matrices. You&#8217;ll then be able to analyze the conversion process and find innovative ways to increase ROI.<\/p>\n<h2 id=\"E142\">Implementing E-Commerce Tracking in Google Analytics<\/h2>\n<h3 id=\"E147\">The First Step: Get a Google Analytics Account<\/h3>\n<\/div>\n<\/div>\n<div>\n<div>\n<p>This is quite simple. Do you have a Google Analytics account yet? If the answer is no, it\u2019s about time you\u00a0\u00a0<a href=\"http:\/\/www.google.co.in\/analytics\/\" target=\"_blank\" rel=\"noopener\">get one<\/a>. If you already have an account, let\u2019s move forward.<\/p>\n<h3 id=\"E154\">The Second Step: Enable Tracking in Google Analytics<\/h3>\n<p>Next comes enabling tracking in Google Analytics. You need to turn on the button meant for e-commerce tracking with these steps:<\/p>\n<p>\u2022 Sign into your Google Analytics account.<br \/>\n\u2022 Choose the desired account.<br \/>\n\u2022 Go to the \u201cAdmin\u201d tab from the top navigation.<\/p>\n<p><span class=\"b-blog__image\"><\/span><br \/>\n\u2022 In the third column from left, choose \u201ce-commerce&#8221; setting.<br \/>\n\u2022 Turn the \u201cEnable e-commerce&#8221; toggle switch to \u201cOn.&#8221;<\/p>\n<p><span class=\"b-blog__image\"><\/span><br \/>\nThis is optional, but you could also set the \u201cEnable Related Products&#8221; toggle to \u201cOn.\u201d Click on the &#8220;Next Step&#8221; It will ask for &#8220;Enhanced E-Commerce Settings.&#8221; If you want to enable it, then toggle the switch to &#8220;On&#8221; or else click &#8220;Submit.&#8221;<\/p>\n<h3 id=\"E192\">The Third Step: Add Tracking Codes<\/h3>\n<p>Now, it\u2019s time to\u00a0add the tracking codes\u00a0onto your website&#8217;s receipt page. Here is the Asynchronous Syntax recommended code by Google:<\/p>\n<p>&lt;html&gt;<br \/>\n&lt;head&gt;<\/p>\n<\/div>\n<\/div>\n<div>\n<div>\n<p>&lt;title&gt;Receipt of your purchase from Shoe Shop&lt;\/title&gt;<br \/>\n&lt;script type=&#8221;text\/javascript&#8221;&gt;<\/p>\n<p>var _gaq = _gaq || [];<br \/>\n_gaq.push([&#8216;_setAccount&#8217;, &#8216;UA-XXXXX-X&#8217;]);<br \/>\n_gaq.push([&#8216;\u00a0<a href=\"https:\/\/developers.google.com\/analytics\/devguides\/collection\/gajs\/methods\/gaJSApiBasicConfiguration\" target=\"_blank\" rel=\"noopener\">_trackPageview<\/a>&#8216;]);<br \/>\n_gaq.push([&#8216;\u00a0<a href=\"https:\/\/developers.google.com\/analytics\/devguides\/collection\/gajs\/methods\/gaJSApiEcommerce.html\" target=\"_blank\" rel=\"noopener\">_addTrans<\/a>&#8216;,<br \/>\n&#8216;9536&#8217;, \/\/ transaction ID &#8211; required<br \/>\n&#8216; Shoe Shop&#8217;,\/\/ affiliation or store name<br \/>\n&#8216;56.23&#8217;,\/\/ total &#8211; required<br \/>\n&#8216;2.56&#8217;, \/\/ tax<br \/>\n&#8216;3&#8217;,\/\/ shipping<br \/>\n&#8216;Las Angeles&#8217;, \/\/ city<br \/>\n&#8216;California&#8217;, \/\/ state or province<br \/>\n&#8216;USA&#8217; \/\/ country<br \/>\n]);<\/p>\n<p>\/\/ add item might be called for every item in the shopping cart<br \/>\n\/\/ where your ecommerce engine loops through each item in the cart and<br \/>\n\/\/ prints out _addItem for each<br \/>\n_gaq.push([&#8216;\u00a0<a href=\"https:\/\/developers.google.com\/analytics\/devguides\/collection\/gajs\/methods\/gaJSApiEcommerce.html\" target=\"_blank\" rel=\"noopener\">_addItem<\/a>&#8216;,<br \/>\n&#8216;9536&#8217;, \/\/ transaction ID \u2013 required<br \/>\n&#8216;DD44&#8217;, \/\/ SKU\/code &#8211; required<br \/>\n&#8216;Nike Shoe&#8217;, \/\/ product name<br \/>\n&#8216;Sport Medium&#8217;, \/\/ category or variation<br \/>\n&#8216;56.23&#8217;,\/\/ unit price &#8211; required<br \/>\n&#8216;1&#8217; \/\/ quantity &#8211; required<br \/>\n]);<br \/>\n_gaq.push([&#8216;\u00a0<a href=\"https:\/\/developers.google.com\/analytics\/devguides\/collection\/gajs\/methods\/gaJSApiEcommerce.html\" target=\"_blank\" rel=\"noopener\">_trackTrans<\/a>&#8216;]); \/\/submits transaction to the Analytics servers<\/p>\n<p>(function() {<br \/>\nvar ga = document.createElement(&#8216;script&#8217;); ga.type = &#8216;text\/javascript&#8217;; ga.async = true;<br \/>\nga.src = (&#8216;https:&#8217; == document.location.protocol ? &#8216;https:\/\/ssl&#8217; : &#8216;http:\/\/www&#8217;) + &#8216;.google-analytics.com\/ga.js&#8217;;<br \/>\nvar s = document.getElementsByTagName(&#8216;script&#8217;)[0]; s.parentNode.insertBefore(ga, s);<br \/>\n})();<\/p>\n<p>&lt;\/script&gt;<br \/>\n&lt;\/head&gt;<br \/>\n&lt;body&gt;<\/p>\n<p>Thank you for your order.You will shortly receive an email containing all your order details.<\/p>\n<p>&lt;\/body&gt;<br \/>\n&lt;\/html&gt;<\/p>\n<\/div>\n<\/div>\n<div>\n<div>\n<p>Note 1: It&#8217;s necessary to add the codes in the receipt page only using all required fields.<br \/>\nNote 2: Make sure that website visitors aren&#8217;t able to access the receipt page directly without making a purchase. Failing at this will skew your e-commerce stats.<\/p>\n<p>The tracking process starts with the initialization of transaction objects by using method _addTrans() in the script. The main goal of the transaction object is to store data related to the transaction. This can include facts like billing address, charges for shipping, and transaction ID.<\/p>\n<p>Syntax: _addTrans(orderID, store name, total revenue, tax, shipping, city, state, country)<\/p>\n<p>Here\u2019s an example:<\/p>\n<p><span class=\"b-blog__image\"><\/span><\/p>\n<p>Note: All items purchased during this transaction must have the same ID.<\/p>\n<p>Next, you&#8217;ll need to add items to the transaction. This is achieved by utilizing the _addItem() method. Remember that the information collected so far is limited to the transaction and won&#8217;t\u00a0include individual items. Therefore, this step is focused on gathering product information, such as stock keeping unit (SKU), total quantity, price, and item category. _addItem() is utilized to store data about the product purchased in the visitor&#8217;s transaction.<\/p>\n<\/div>\n<\/div>\n<div>\n<div>\n<p>Syntax: _addItem(orderID, Product-SKU, Product-Name, Product-Category, Product-Price, Quantity)<\/p>\n<p>Here\u2019s an example:<\/p>\n<p><span class=\"b-blog__image\"><\/span><br \/>\nAll that&#8217;s left now is to submit the data collected into the Google Analytics Server. This is accomplished through the _trackTrans() method. _trackTrans() occurs only once the transaction is actually completed. Of course, interpretation of the transaction tracking data will depend on the engine that you choose. Good ones will significantly simplify the data before presenting it to you. Rest assured that almost all e-commerce engines recognize and accept Google Analytics data though.<\/p>\n<p>Here\u2019s how the _trackTrans() method works:<\/p>\n<p>_trackTrans() is utilized to send e-commerce tracking data to Google Analytics via an invisible _utm.gif file. The file is requested in two instances:<\/p>\n<p>1. Each visitor\u2019s transaction<br \/>\n2. Each unique product<\/p>\n<p>Syntax: _gaq.push([\u2018_trackTrans\u2019]);<\/p>\n<p>Note 1: The _trackTrans() method should always be called after the following methods: _trackPageView(), _addTrans(), and _addItem() methods.<\/p>\n<p>Note 2: The use of _trackPageView() will associate the purchase with the page titled something like \u201cReceipt of your purchase \u2013 Shoe Shop\u201d<\/p>\n<\/div>\n<\/div>\n<div>\n<div>\n<p>Note 3: The _gaq is a global object that can be used directly for an asynchronous page tracking with the push (&#8230;) method.<\/p>\n<h2 id=\"E789\">Collecting Meaningful Analytics Data<\/h2>\n<p>Google Analytics has the power to steer your business in the right direction if it&#8217;s veering towards the wrong path. Yet, you&#8217;ll need data that&#8217;s meaningful without any room for ambiguity to ensure this holds true. Keep in mind that Analytics will churn out only data that&#8217;s supplied to it. Don&#8217;t forget the following handy tactics.<\/p>\n<p>[Tweet &#8220;Make sure your Google Analytics e-comm data is meaningful.&#8221;]<\/p>\n<p>\u2022 The argument list for both _addItem() and _addTrans() is correspondent to position. Certainly, you don\u2019t need all of the arguments, but supplying empty placeholders for arguments that aren&#8217;t specified is vital. This will prevent calculation errors. For instance, you could add an item that contains quantity, place, SKU, and transaction ID in this manner: _addItem(&#8220;9856&#8221;, &#8220;684&#8221;, &#8220;&#8221;, &#8220;&#8221;, &#8220;95.61&#8221;, &#8220;1&#8221;);<\/p>\n<p>\u2022 SKU codes are a must for every item in the transaction. When the SKU isn&#8217;t provided for all items, then\u00a0<a href=\"http:\/\/www.analyticsmarket.com\/blog\/__utmgif-data\" target=\"_blank\" rel=\"noopener\">\u00a0GIF request<\/a>\u00a0would only be requested for the last product containing a SKU. Also, if the same SKU is assigned to multiple products, the e-commerce tracking data would only be available for the one added most recently. Your analytics will be skewed in both cases because all transaction purchases wouldn&#8217;t be accounted for.<\/p>\n<p>\u2022 Currency conversions ought to be handled before sending the data to the Google Analytics server. The \u201cPrice\u201d and \u201cTotal\u201d parameters don&#8217;t follow any currency formatting. Without currency formatting, the parameters consider the period (.) and comma (,) as fractional value. Unless handled by your eCommerce platform&#8217;s software, the e-commerce tracking data sent to Analytics will consider 44,550 dollars as $44.55 which will end up by supplying very wrong input.<\/p>\n<p>Consider all of these aspects while implementing e-commerce tracking in your Google Analytics account. Then, you&#8217;ll be less likely to miss anything about your purchases.\u00a0 [create-campaign destination_url=&#8221;https:\/\/www.semrush.com\/academy\/courses\/ppc-fundamentals-course-with-joel-bondorowsky\/?utm_source=academy&amp;utm_medium=blog_ecommerce_tracking_ga&amp;utm_campaign=trial-banners_ppc_fundamentals&#8221; show_input=&#8221;false&#8221; header=&#8221;Learn the basics of PPC advertising&#8221; text=&#8221;PPC Fundamentals Course with Joel Bondorowsky&#8221; button_text=&#8221;Enroll for free&#8221; bg_images=&#8221;https:\/\/static.semrush.com\/blog\/uploads\/media\/54\/02\/540217b5b95f1223e832ebbd4cfb6986\/banners-5.png&#8221; \u00a0bg_button=&#8221;-warning&#8221;]<\/p>\n<h2 id=\"E843\">Need Help?<\/h2>\n<p>E-commerce tracking is a rather complex subject for website owners to understand and implement. Tracking mechanisms typically vary greatly from one business to another. If you&#8217;re struggling with an e-commerce tracking problem, I&#8217;d love to lend a helping hand. Simply leave me a message in the comments section below. I&#8217;ll get you out of your coding misery in no time. Happy tracking!<\/p>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>How To Implement Ecommerce Tracking in Google Analytics You&#8217;ve likely heard the term, but what exactly is e-commerce tracking? In short, it&#8217;s a feature on Google Analytics that allows you to track online transactions on e-commerce websites. It provides detailed\u2026<\/p>\n","protected":false},"author":0,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[474],"tags":[],"class_list":["post-14364","post","type-post","status-publish","format-standard","hentry","category-ecommerce-2"],"_links":{"self":[{"href":"https:\/\/alienroad.com\/wp-json\/wp\/v2\/posts\/14364","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/alienroad.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/alienroad.com\/wp-json\/wp\/v2\/types\/post"}],"replies":[{"embeddable":true,"href":"https:\/\/alienroad.com\/wp-json\/wp\/v2\/comments?post=14364"}],"version-history":[{"count":0,"href":"https:\/\/alienroad.com\/wp-json\/wp\/v2\/posts\/14364\/revisions"}],"wp:attachment":[{"href":"https:\/\/alienroad.com\/wp-json\/wp\/v2\/media?parent=14364"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/alienroad.com\/wp-json\/wp\/v2\/categories?post=14364"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/alienroad.com\/wp-json\/wp\/v2\/tags?post=14364"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}