Ecommerce software home
Shopping Cart Software Forum for Ecommerce Templates
 
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

Find us on Facebook Follow us on Twitter View our YouTube channel
Search our site
 All Forums
 General
 Off topic, News and Updates
 Google Analytics 4 Instructions
Author « Topic »  

Vince
Administrator

Spain
42455 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.asp

After 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 Software
Click Here to sign up for our newsletter
Click Here for the latest updater

Vince
Administrator

42455 Posts

Posted - 11/11/2021 :  03:42:56  
There is an update for both Betas to add functionality so that cart removals are now sent to Google Analytics. But there is also an important fix for the ASP version that can will cure a possible server error.

Vince

Click Here for Shopping Cart Software
Click Here to sign up for our newsletter
Click Here for the latest updater

Vince
Administrator

42455 Posts

Posted - 11/12/2021 :  06:09:22  
More improvements for the Betas available. We are now using a better way to implement the "Add to Cart" process so you will need a new copy of the file...
/js/ectcart.js
https://www.ecommercetemplates.com/updaters.asp?betas=true

Vince

Click Here for Shopping Cart Software
Click Here to sign up for our newsletter
Click Here for the latest updater

Phil
ECT Moderator

United Kingdom
7617 Posts

Posted - 11/13/2021 :  03:34:40  
Hi Vince,
quote:
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.



Will this also apply to the WordPress version bearing in mind the analytics code may be added using a different method?



*Contact Us*
*Buy The PHP Capture Card Plugin*
*Rate Our Services/View Our Feedback*

Vince
Administrator

42455 Posts

Posted - 11/13/2021 :  09:19:38  
Hi Phil
Good point and I've now updated the ECT Widgets Plugin to take account of Google Analytics. Once set in the ECT Shopping Cart Admin it will all be taken care of. You will need a new copy of the ECT Widgets plugin as here however...
https://www.ecommercetemplates.com/free_downloads.asp#wordpress

Vince

Click Here for Shopping Cart Software
Click Here to sign up for our newsletter
Click Here for the latest updater

midvalleydrifter001
Ecommerce Template Expert

USA
912 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

42455 Posts

Posted - 11/13/2021 :  09:45:32  

sparksm
Advanced Member

125 Posts

Pre-sales questions only
(More Details...)

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

42455 Posts

Posted - 11/19/2021 :  10:46:00  

ITZAP
Ecommerce Template Guru

Australia
1007 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 = googleanalytics

and 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
4476 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
1007 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
4476 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
1007 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
4476 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

816 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

42455 Posts

Posted - 06/09/2023 :  01:47:12  
Hi Graham
Adding the GA4 code to the template is not normally too error prone so why not let us know the URL of your test page and we can take a look?

Vince

Click Here for Shopping Cart Software
Click Here to sign up for our newsletter
Click Here for the latest updater

Graham Slaughter
Ecommerce Template Expert

816 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

42455 Posts

Posted - 06/11/2023 :  01:55:12  
quote:
Thanks again for your hard work for all of us!

Thanks Graham!!

Vince

Click Here for Shopping Cart Software
Click Here to sign up for our newsletter
Click Here for the latest updater
  « Topic »  
Jump To:
Shopping Cart Software Forum for Ecommerce Templates © 2002-2022 ecommercetemplates.com
This page was generated in 0.06 seconds. Snitz Forums 2000