Vince
Administrator
Spain
42743 Posts |
Posted - 11/10/2021 : 10:52:07
Google Analytics 4 is now available in both the stability and advanced releases... https://www.ecommercetemplates.com/updaters.aspAfter updating if necessary, do the following to setup your Google Analytics GA4 Site ID. Go to your Google Analytics account and login if necessary at ... https://analytics.google.com/ In the left hand border at the bottom click on the wheel for "Admin" If you have not already done so, click to create an account Create a Property for that new account, selecting your time zone and currency. Under this new Property click on "Data Streams" from the list there. Click on the blue "Add Stream" button on the right hand side and choose, "Web" when prompted. Now click on this new stream that you have created and you should see a heading on the right, "MEASUREMENT ID", and below that an ID of the form, "G-AAAAAAAAAA". Copy this ID as this is what you will need for the ECT Admin. Now go to your ECT Admin, click on STORE ADMIN -> main settings and go down to the heading, "Google reCAPTCHA + Analytics 4" and you should see where to enter this ID. If you are using the "incectstyle.asp/php" include file then you don't need to do anything else as the Global Site Tag code is already included automatically. If you are not using the incectstyle include file then you just need to add this code to the head section of your template so that it appears on all pages... <script async src="https://www.googletagmanager.com/gtag/js?id=G-AAAAAAAAAA"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-AAAAAAAAAA'); </script> You will need to change both of those instances of G-AAAAAAAAAA with your own ID. Vince Click Here for Shopping Cart SoftwareClick Here to sign up for our newsletterClick Here for the latest updater
|
Vince
Administrator
42743 Posts |
Posted - 11/11/2021 : 03:42:56
|
Vince
Administrator
42743 Posts |
Posted - 11/12/2021 : 06:09:22
|
Phil
ECT Moderator
United Kingdom
7679 Posts |
Posted - 11/13/2021 : 03:34:40
|
Vince
Administrator
42743 Posts |
Posted - 11/13/2021 : 09:19:38
|
midvalleydrifter001
Ecommerce Template Expert
USA
931 Posts |
Posted - 11/13/2021 : 09:31:40
Just to clarify:
We would need "One" of the two on every page?
incectstyle.asp/php
OR
<script async src="https://www.googletagmanager.com/gtag/js?id=G-AAAAAAAAAA"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-AAAAAAAAAA'); </script>
|
Vince
Administrator
42743 Posts |
Posted - 11/13/2021 : 09:45:32
|
sparksm
Advanced Member
125 Posts |
Posted - 11/19/2021 : 09:40:33
Does there need to be anything additional for the thanks page to track conversions?
On the previous version a couple code snippets were needed such as: ga('require','ecommerce','ecommerce.js'); <% print googleanalyticstrackorderinfo%>
Wasn't sure if anything special like that was needed in GA4.
|
Vince
Administrator
42743 Posts |
Posted - 11/19/2021 : 10:46:00
|
ITZAP
Ecommerce Template Guru
Australia
1017 Posts |
Posted - 11/20/2021 : 18:21:50
Vince said: quote: If you are not using the incectstyle include file then you just need to add this code to the head section of your template so that it appears on all pages...
<script async src="https://www.googletagmanager.com/gtag/js?id=G-AAAAAAAAAA"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-AAAAAAAAAA'); </script>
You will need to change both of those instances of G-AAAAAAAAAA with your own ID.
Perhaps I can suggest a method to do ^^^ this easily. (1) Create a file named " googleanalytics.php", copy/paste in that Google Analytics 4 code snippet, then upload to your website server. (2) Open your Adobe Dreamweaver website template .dwt file and, in the <head> section go Menu ... Insert ... Template ... Editable Region ... Name = googleanalyticsand edit that template code entry like so: <!-- TemplateBeginEditable name="googleanalytics" --> <?php include_once ("googleanalytics.php") ?> <!-- TemplateEndEditable -->(3) Save changes to your template .dwt file, which will then Update and insert that code into all website files based upon that template. (4) Now, open each webpage which you do not want that Google Analytics 4 code snippet inserted and delete the <?php include_once> line so that editable region is empty, like: <!-- TemplateBeginEditable name="googleanalytics" --> <!-- TemplateEndEditable -->(5) Save each file you edited, and finally, UPLOAD ALL edited files to your server. => SO NOW, if that Google Analytics 4 code snippet ever changes, you will only need to update the one " googleanalytics.php" file, not every damn page on your website And if you administer a few different websites, use the same method and merely change the G-AAAAAAAAAA entries in " googleanalytics.php" accordingly. Gary
Edited by - ITZAP on 11/20/2021 18:33:46
|
insight
ECT Moderator
USA
4479 Posts |
Posted - 11/20/2021 : 22:44:58
I quit using Dreamweaver years ago, so maybe I am off track here, but why do all that when if you place that code in a non-editable region of the .dwt file it will propagate to all pages anyway. Isn't that the point of using a Dreamweaver template? Peter Professional ecommerce web hosting services Shared hosting Windows & Linux | Dedicated servers | Domains | SSL Ecommerce Templates specialists since 2003 https://servelink.com
|
ITZAP
Ecommerce Template Guru
Australia
1017 Posts |
Posted - 11/20/2021 : 22:52:37
Peter, “TemplateBeginEditable” is an editable region. So you do get to choose whether to include the GA4 code snippet, or not, for each individual page. Gary
|
insight
ECT Moderator
USA
4479 Posts |
Posted - 11/20/2021 : 23:39:50
Sure, but why would you not want your tracking to be as accurate as possible by including the code on every page? Not only is that easier, but it's the only way you'll be able to get full data about visitor behavior, checkout flow, landing pages, time on the site and what have you. Peter Professional ecommerce web hosting services Shared hosting Windows & Linux | Dedicated servers | Domains | SSL Ecommerce Templates specialists since 2003 https://servelink.com
|
ITZAP
Ecommerce Template Guru
Australia
1017 Posts |
Posted - 11/21/2021 : 00:09:02
Read (3). You will have GA4 on every page. Read (4). Explains how you can remove GA4 on certain pages, as you wish. (like search.php, clientlogin.php, affiliate.php, error pages) Not following what I wrote at all. Gary
Edited by - ITZAP on 11/21/2021 00:13:31
|
insight
ECT Moderator
USA
4479 Posts |
Posted - 11/21/2021 : 01:32:04
Why do (3) when adding it to the .dwt will place it on every page anyway? Just extra steps and extra fuss for no benefit. Why do (4) when you ideally want tracking on every page, including the ones you cite? But, as I said, I don't use Dreamweaver so it doesn't matter to me at all, I was just curious about the merits of this and you've kindly answered that for me. Peter Professional ecommerce web hosting services Shared hosting Windows & Linux | Dedicated servers | Domains | SSL Ecommerce Templates specialists since 2003 https://servelink.com
|
Graham Slaughter
Ecommerce Template Expert
821 Posts |
Posted - 06/08/2023 : 09:36:18
I'm trying to weave in the GA4 events coding into our cart software (old version) now while I work on migrating everything else to a more current version.
I dont suppose you could activate the GA4 analytics tracking in the demo store so that I can compare my implementation to a working vanilla ECT implementation? I seem to be missing something and cant quite put my finger on it...
|
Vince
Administrator
42743 Posts |
Posted - 06/09/2023 : 01:47:12
|
Graham Slaughter
Ecommerce Template Expert
821 Posts |
Posted - 06/09/2023 : 08:10:32
I finally figured it out my friend.
The Analytics tag MUST be placed inside the <HEAD>. Mine was placed in the footer which caused the events firing later in the code to not be processed correctly. Working as intended now. Thanks again for your hard work for all of us!
|
Vince
Administrator
42743 Posts |
Posted - 06/11/2023 : 01:55:12
|
|
|