{"id":1141,"date":"2020-01-06T17:56:33","date_gmt":"2020-01-06T12:26:33","guid":{"rendered":"https:\/\/www.huntbee.com\/resources\/docs\/google-analytics-enhanced-ecommerce-tracking-for-opencart\/installation\/journal3-template\/"},"modified":"2023-02-10T10:27:16","modified_gmt":"2023-02-10T04:57:16","slug":"journal3-template","status":"publish","type":"docs","link":"https:\/\/www.huntbee.com\/resources\/docs\/google-analytics-enhanced-ecommerce-tracking-for-opencart\/installation\/journal3-template\/","title":{"rendered":"Journal3 Template"},"content":{"rendered":"\n<p>The ocmod adds the add to cart tracking script to the product page. You will also need to setup manually in case if you want to track the addition of items or removal of items from the product list or grids. This setup is manual because this is the best &amp; effective way to do this without unnecessary loading of more scripts &amp; queries.<\/p>\n\n\n\n<h4 class=\"has-vivid-red-color has-text-color wp-block-heading\"><strong>Please follow the below step (only if you are a developer)<\/strong><\/h4>\n\n\n\n<p>The activity involves the identification of the javascript file which is responsible for add to cart \/ remove cart activity. <\/p>\n\n\n\n<p>Open<strong> catalog\/view\/theme\/journal3\/js\/common.js<\/strong><\/p>\n\n\n\n<p><strong>Change 1: Add the following code the end of the page<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">function gaAddtocart(e){$.ajax({url:\"index.php?route=extension\/module\/google_ecommerce\/get_product_info&amp;product_id=\"+e,type:\"post\",dataType:\"json\",success:function(e){e.error?console.log(e.error):gtag(\"event\",\"select_content\",{\"content_type\": \"product\",items:[e.product_info]});gtag(\"event\",\"add_to_cart\",{items:[e.product_info]}),console.log(e.product_info),e.pixel_info&amp;&amp;(fbq(\"track\",\"AddToCart\",e.pixel_info),console.log(e.pixel_info))}})}function gaRemovefromcart(e){$.ajax({url:\"index.php?route=extension\/module\/google_ecommerce\/get_product_info&amp;product_id=\"+e,type:\"post\",dataType:\"json\",success:function(e){e.error?console.log(e.error):gtag(\"event\",\"select_content\",{\"content_type\": \"product\",items:[e.product_info]});gtag(\"event\",\"remove_from_cart\",{items:[e.product_info]})}})}<\/pre>\n\n\n\n<p><strong><em>Example:<\/em><\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"183\" src=\"https:\/\/www.huntbee.com\/resources\/wp-content\/uploads\/2020\/01\/jounal3-ga-update-1-1024x183.jpg\" alt=\"\" class=\"wp-image-1143\" srcset=\"https:\/\/www.huntbee.com\/resources\/wp-content\/uploads\/2020\/01\/jounal3-ga-update-1-1024x183.jpg 1024w, https:\/\/www.huntbee.com\/resources\/wp-content\/uploads\/2020\/01\/jounal3-ga-update-1-300x53.jpg 300w, https:\/\/www.huntbee.com\/resources\/wp-content\/uploads\/2020\/01\/jounal3-ga-update-1-768x137.jpg 768w, https:\/\/www.huntbee.com\/resources\/wp-content\/uploads\/2020\/01\/jounal3-ga-update-1-1920x345.jpg 1920w, https:\/\/www.huntbee.com\/resources\/wp-content\/uploads\/2020\/01\/jounal3-ga-update-1.jpg 1935w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><strong>Change 2: Identify the add to cart function and add the following function just after the success command<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">gaAddtocart(product_id); \n<\/pre>\n\n\n\n<p><em><strong>Example:<\/strong><\/em><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"402\" src=\"https:\/\/www.huntbee.com\/resources\/wp-content\/uploads\/2020\/01\/jounal3-ga-update-2-1024x402.jpg\" alt=\"\" class=\"wp-image-1144\" srcset=\"https:\/\/www.huntbee.com\/resources\/wp-content\/uploads\/2020\/01\/jounal3-ga-update-2-1024x402.jpg 1024w, https:\/\/www.huntbee.com\/resources\/wp-content\/uploads\/2020\/01\/jounal3-ga-update-2-300x118.jpg 300w, https:\/\/www.huntbee.com\/resources\/wp-content\/uploads\/2020\/01\/jounal3-ga-update-2-768x302.jpg 768w, https:\/\/www.huntbee.com\/resources\/wp-content\/uploads\/2020\/01\/jounal3-ga-update-2.jpg 1668w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><strong>Change 3:&nbsp;Identify the remove function and add the following function just after the success command<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">gaRemovefromcart(json.product_id);<\/pre>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"513\" src=\"https:\/\/www.huntbee.com\/resources\/wp-content\/uploads\/2020\/01\/jounal3-ga-update-3-1024x513.jpg\" alt=\"\" class=\"wp-image-1145\" srcset=\"https:\/\/www.huntbee.com\/resources\/wp-content\/uploads\/2020\/01\/jounal3-ga-update-3-1024x513.jpg 1024w, https:\/\/www.huntbee.com\/resources\/wp-content\/uploads\/2020\/01\/jounal3-ga-update-3-300x150.jpg 300w, https:\/\/www.huntbee.com\/resources\/wp-content\/uploads\/2020\/01\/jounal3-ga-update-3-768x385.jpg 768w, https:\/\/www.huntbee.com\/resources\/wp-content\/uploads\/2020\/01\/jounal3-ga-update-3.jpg 1191w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n","protected":false},"featured_media":0,"parent":870,"menu_order":2,"comment_status":"open","ping_status":"closed","template":"","doc_tag":[],"class_list":["post-1141","docs","type-docs","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Journal3 Template - HuntBee Resources<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.huntbee.com\/resources\/docs\/google-analytics-enhanced-ecommerce-tracking-for-opencart\/installation\/journal3-template\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Journal3 Template - HuntBee Resources\" \/>\n<meta property=\"og:description\" content=\"The ocmod adds the add to cart tracking script to the product page. You will also need to setup manually in case if you want to track the addition of items or removal of items from the product list or grids. This setup is manual because this is the best &amp; effective way to do [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.huntbee.com\/resources\/docs\/google-analytics-enhanced-ecommerce-tracking-for-opencart\/installation\/journal3-template\/\" \/>\n<meta property=\"og:site_name\" content=\"HuntBee Resources\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/huntbee.opencart\" \/>\n<meta property=\"article:modified_time\" content=\"2023-02-10T04:57:16+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.huntbee.com\/resources\/wp-content\/uploads\/2020\/01\/jounal3-ga-update-1-1024x183.jpg\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.huntbee.com\\\/resources\\\/docs\\\/google-analytics-enhanced-ecommerce-tracking-for-opencart\\\/installation\\\/journal3-template\\\/\",\"url\":\"https:\\\/\\\/www.huntbee.com\\\/resources\\\/docs\\\/google-analytics-enhanced-ecommerce-tracking-for-opencart\\\/installation\\\/journal3-template\\\/\",\"name\":\"Journal3 Template - HuntBee Resources\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.huntbee.com\\\/resources\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.huntbee.com\\\/resources\\\/docs\\\/google-analytics-enhanced-ecommerce-tracking-for-opencart\\\/installation\\\/journal3-template\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.huntbee.com\\\/resources\\\/docs\\\/google-analytics-enhanced-ecommerce-tracking-for-opencart\\\/installation\\\/journal3-template\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.huntbee.com\\\/resources\\\/wp-content\\\/uploads\\\/2020\\\/01\\\/jounal3-ga-update-1-1024x183.jpg\",\"datePublished\":\"2020-01-06T12:26:33+00:00\",\"dateModified\":\"2023-02-10T04:57:16+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.huntbee.com\\\/resources\\\/docs\\\/google-analytics-enhanced-ecommerce-tracking-for-opencart\\\/installation\\\/journal3-template\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.huntbee.com\\\/resources\\\/docs\\\/google-analytics-enhanced-ecommerce-tracking-for-opencart\\\/installation\\\/journal3-template\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.huntbee.com\\\/resources\\\/docs\\\/google-analytics-enhanced-ecommerce-tracking-for-opencart\\\/installation\\\/journal3-template\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.huntbee.com\\\/resources\\\/wp-content\\\/uploads\\\/2020\\\/01\\\/jounal3-ga-update-1.jpg\",\"contentUrl\":\"https:\\\/\\\/www.huntbee.com\\\/resources\\\/wp-content\\\/uploads\\\/2020\\\/01\\\/jounal3-ga-update-1.jpg\",\"width\":1935,\"height\":345},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.huntbee.com\\\/resources\\\/docs\\\/google-analytics-enhanced-ecommerce-tracking-for-opencart\\\/installation\\\/journal3-template\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.huntbee.com\\\/resources\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Google Analytics Enhanced Ecommerce Tracking for OpenCart\",\"item\":\"https:\\\/\\\/www.huntbee.com\\\/resources\\\/docs\\\/google-analytics-enhanced-ecommerce-tracking-for-opencart\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Installation\",\"item\":\"https:\\\/\\\/www.huntbee.com\\\/resources\\\/docs\\\/google-analytics-enhanced-ecommerce-tracking-for-opencart\\\/installation\\\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Journal3 Template\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.huntbee.com\\\/resources\\\/#website\",\"url\":\"https:\\\/\\\/www.huntbee.com\\\/resources\\\/\",\"name\":\"HuntBee Resources\",\"description\":\"OpenCart Extension Documentations - Guides - Blogs - Projects\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.huntbee.com\\\/resources\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.huntbee.com\\\/resources\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.huntbee.com\\\/resources\\\/#organization\",\"name\":\"HuntBee OpenCart\",\"url\":\"https:\\\/\\\/www.huntbee.com\\\/resources\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.huntbee.com\\\/resources\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.huntbee.com\\\/resources\\\/wp-content\\\/uploads\\\/2020\\\/04\\\/cropped-mobile-logo-new.png\",\"contentUrl\":\"https:\\\/\\\/www.huntbee.com\\\/resources\\\/wp-content\\\/uploads\\\/2020\\\/04\\\/cropped-mobile-logo-new.png\",\"width\":945,\"height\":200,\"caption\":\"HuntBee OpenCart\"},\"image\":{\"@id\":\"https:\\\/\\\/www.huntbee.com\\\/resources\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/huntbee.opencart\",\"https:\\\/\\\/www.instagram.com\\\/opencart.huntbee\\\/\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Journal3 Template - HuntBee Resources","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.huntbee.com\/resources\/docs\/google-analytics-enhanced-ecommerce-tracking-for-opencart\/installation\/journal3-template\/","og_locale":"en_US","og_type":"article","og_title":"Journal3 Template - HuntBee Resources","og_description":"The ocmod adds the add to cart tracking script to the product page. You will also need to setup manually in case if you want to track the addition of items or removal of items from the product list or grids. This setup is manual because this is the best &amp; effective way to do [&hellip;]","og_url":"https:\/\/www.huntbee.com\/resources\/docs\/google-analytics-enhanced-ecommerce-tracking-for-opencart\/installation\/journal3-template\/","og_site_name":"HuntBee Resources","article_publisher":"https:\/\/www.facebook.com\/huntbee.opencart","article_modified_time":"2023-02-10T04:57:16+00:00","og_image":[{"url":"https:\/\/www.huntbee.com\/resources\/wp-content\/uploads\/2020\/01\/jounal3-ga-update-1-1024x183.jpg","type":"","width":"","height":""}],"twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.huntbee.com\/resources\/docs\/google-analytics-enhanced-ecommerce-tracking-for-opencart\/installation\/journal3-template\/","url":"https:\/\/www.huntbee.com\/resources\/docs\/google-analytics-enhanced-ecommerce-tracking-for-opencart\/installation\/journal3-template\/","name":"Journal3 Template - HuntBee Resources","isPartOf":{"@id":"https:\/\/www.huntbee.com\/resources\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.huntbee.com\/resources\/docs\/google-analytics-enhanced-ecommerce-tracking-for-opencart\/installation\/journal3-template\/#primaryimage"},"image":{"@id":"https:\/\/www.huntbee.com\/resources\/docs\/google-analytics-enhanced-ecommerce-tracking-for-opencart\/installation\/journal3-template\/#primaryimage"},"thumbnailUrl":"https:\/\/www.huntbee.com\/resources\/wp-content\/uploads\/2020\/01\/jounal3-ga-update-1-1024x183.jpg","datePublished":"2020-01-06T12:26:33+00:00","dateModified":"2023-02-10T04:57:16+00:00","breadcrumb":{"@id":"https:\/\/www.huntbee.com\/resources\/docs\/google-analytics-enhanced-ecommerce-tracking-for-opencart\/installation\/journal3-template\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.huntbee.com\/resources\/docs\/google-analytics-enhanced-ecommerce-tracking-for-opencart\/installation\/journal3-template\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.huntbee.com\/resources\/docs\/google-analytics-enhanced-ecommerce-tracking-for-opencart\/installation\/journal3-template\/#primaryimage","url":"https:\/\/www.huntbee.com\/resources\/wp-content\/uploads\/2020\/01\/jounal3-ga-update-1.jpg","contentUrl":"https:\/\/www.huntbee.com\/resources\/wp-content\/uploads\/2020\/01\/jounal3-ga-update-1.jpg","width":1935,"height":345},{"@type":"BreadcrumbList","@id":"https:\/\/www.huntbee.com\/resources\/docs\/google-analytics-enhanced-ecommerce-tracking-for-opencart\/installation\/journal3-template\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.huntbee.com\/resources\/"},{"@type":"ListItem","position":2,"name":"Google Analytics Enhanced Ecommerce Tracking for OpenCart","item":"https:\/\/www.huntbee.com\/resources\/docs\/google-analytics-enhanced-ecommerce-tracking-for-opencart\/"},{"@type":"ListItem","position":3,"name":"Installation","item":"https:\/\/www.huntbee.com\/resources\/docs\/google-analytics-enhanced-ecommerce-tracking-for-opencart\/installation\/"},{"@type":"ListItem","position":4,"name":"Journal3 Template"}]},{"@type":"WebSite","@id":"https:\/\/www.huntbee.com\/resources\/#website","url":"https:\/\/www.huntbee.com\/resources\/","name":"HuntBee Resources","description":"OpenCart Extension Documentations - Guides - Blogs - Projects","publisher":{"@id":"https:\/\/www.huntbee.com\/resources\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.huntbee.com\/resources\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.huntbee.com\/resources\/#organization","name":"HuntBee OpenCart","url":"https:\/\/www.huntbee.com\/resources\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.huntbee.com\/resources\/#\/schema\/logo\/image\/","url":"https:\/\/www.huntbee.com\/resources\/wp-content\/uploads\/2020\/04\/cropped-mobile-logo-new.png","contentUrl":"https:\/\/www.huntbee.com\/resources\/wp-content\/uploads\/2020\/04\/cropped-mobile-logo-new.png","width":945,"height":200,"caption":"HuntBee OpenCart"},"image":{"@id":"https:\/\/www.huntbee.com\/resources\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/huntbee.opencart","https:\/\/www.instagram.com\/opencart.huntbee\/"]}]}},"comment_count":0,"_links":{"self":[{"href":"https:\/\/www.huntbee.com\/resources\/wp-json\/wp\/v2\/docs\/1141","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.huntbee.com\/resources\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/www.huntbee.com\/resources\/wp-json\/wp\/v2\/types\/docs"}],"replies":[{"embeddable":true,"href":"https:\/\/www.huntbee.com\/resources\/wp-json\/wp\/v2\/comments?post=1141"}],"version-history":[{"count":5,"href":"https:\/\/www.huntbee.com\/resources\/wp-json\/wp\/v2\/docs\/1141\/revisions"}],"predecessor-version":[{"id":1770,"href":"https:\/\/www.huntbee.com\/resources\/wp-json\/wp\/v2\/docs\/1141\/revisions\/1770"}],"up":[{"embeddable":true,"href":"https:\/\/www.huntbee.com\/resources\/wp-json\/wp\/v2\/docs\/870"}],"next":[{"title":"Learn about the next generation of Google Analytics - GA4","link":"https:\/\/www.huntbee.com\/resources\/docs\/google-analytics-enhanced-ecommerce-tracking-for-opencart\/installation\/learn-about-the-next-generation-of-google-analytics-ga4\/","href":"https:\/\/www.huntbee.com\/resources\/wp-json\/wp\/v2\/docs\/1871"}],"prev":[{"title":"Journal2 Template","link":"https:\/\/www.huntbee.com\/resources\/docs\/google-analytics-enhanced-ecommerce-tracking-for-opencart\/installation\/journal2-user\/","href":"https:\/\/www.huntbee.com\/resources\/wp-json\/wp\/v2\/docs\/880"}],"wp:attachment":[{"href":"https:\/\/www.huntbee.com\/resources\/wp-json\/wp\/v2\/media?parent=1141"}],"wp:term":[{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/www.huntbee.com\/resources\/wp-json\/wp\/v2\/doc_tag?post=1141"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}