Zen Cart Logo
Forums / All Other Contributions/Addons / GA-4 Analytics [Support Thread]

GA-4 Analytics [Support Thread]

Views: 300,449

Results 41 to 60 of 61
16 Feb 2025, 12:22 AM
#41
brian70809 avatar

brian70809

New Zenner

Join Date:
Jun 2011
Posts:
85
Plugin Contributions:
0

GA-4 Analytics [Support Thread]

I'm getting this on a new install of ZC 2.1

--> PHP Warning: Undefined array key "products_name" in xxxx zc_plugins/GA4/v2.0.1/catalog/includes/classes/observers/ga4AnalyticsObserver.php on line 741.

I'm going to turn it off.. I see where it's supposed to get it on line 741.. not sure why it is not getting it.

16 Feb 2025, 12:40 AM
#42
brian70809 avatar

brian70809

New Zenner

Join Date:
Jun 2011
Posts:
85
Plugin Contributions:
0

Re: GA-4 Analytics [Support Thread]

Same Problem with GitHub Version

16 Feb 2025, 1:05 PM
#43
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,086
Plugin Contributions:
56

Re: GA-4 Analytics [Support Thread]

brian70809:

I'm getting this on a new install of ZC 2.1

--> PHP Warning: Undefined array key "products_name" in xxxx zc_plugins/GA4/v2.0.1/catalog/includes/classes/observers/ga4AnalyticsObserver.php on line 741.

I'm going to turn it off.. I see where it's supposed to get it on line 741.. not sure why it is not getting it.
A copy of the full log with the backtrace information would help a lot, since it's the calling path that's introduced the issue.

7 Mar 2025, 3:25 AM
#44
joeyzone avatar

joeyzone

New Zenner

Join Date:
Feb 2023
Posts:
2
Plugin Contributions:
0

Re: GA-4 Analytics [Support Thread]

lat9:

A copy of the full log with the backtrace information would help a lot, since it's the calling path that's introduced the issue.

#0 /zc_plugins/GA4/v2.0.1/catalog/includes/classes/observers/ga4AnalyticsObserver.php(741): zen_debug_error_handler()
#1 /zc_plugins/GA4/v2.0.1/catalog/includes/classes/observers/ga4AnalyticsObserver.php(238): ga4AnalyticsObserver->getItemInfo()
#2 /includes/classes/traits/NotifierManager.php(106): ga4AnalyticsObserver->update()
#3 /includes/templates/wokiee/common/tpl_main_page.php(241): base->notify()
#4 /index.php(94): require('/home/afiwwe6sf...')
--> PHP Warning: Undefined array key "products_name" in /zc_plugins/GA4/v2.0.1/catalog/includes/classes/observers/ga4AnalyticsObserver.php on line 741.

7 Mar 2025, 6:46 AM
#45
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,695
Plugin Contributions:
56

Re: GA-4 Analytics [Support Thread]

This bug has already been reported here:

https://github.com/lat9/ga4-analytics/issues/29

2 Apr 2025, 11:42 PM
#46
nicksab avatar

nicksab

Totally Zenned

Join Date:
Apr 2011
Posts:
592
Plugin Contributions:
0

Re: GA-4 Analytics [Support Thread]

ZC 2.0.1 with GA-4 analytics version 1.2.4

Not sure if it normal behavior or a bug but when looking the page source of main page, it appears the script is being loaded 2 times. Site is at www.royal-fleur(dot)com for reference

<html dir="ltr" lang="en" prefix="og: https://ogp.me/ns# fb: https://ogp.me/ns/fb# product: https://ogp.me/ns/product#">
  <head>
  <!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-JQL28SP4BW"></script>
<script>
    window.dataLayer = window.dataLayer || [];
    function gtag(){dataLayer.push(arguments);}
    gtag('js', new Date());
    gtag('config', 'G-JQL28SP4BW');
</script>
 <meta charset="utf-8">
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-JQL28SP4BW"></script>
<script>
    window.dataLayer = window.dataLayer || [];
    function gtag(){dataLayer.push(arguments);}
    gtag('js', new Date());
    gtag('config', 'G-JQL28SP4BW');
</script>
    <link rel="preload" href="https://code.jquery.com/jquery-3.7.1.min.js" integrity="sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo=" crossorigin="anonymous" as="script">
    <link rel="preload" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" integrity="sha384-xOolHFLEh07PJGoPkLv1IbcEPTNtaed2xpHsD9ESMhqIYd0nLMwNLD69Npy4HI+N" crossorigin="anonymous" as="style">

Is this normal behavior? If not how can i fix it?

Would upgrading to the latest version help? I am on ZC 2.0.1 so it may not be compatible.

Thank you for your time and help

3 Apr 2025, 12:06 AM
#47
dbltoe avatar

dbltoe

Totally Zenned

Join Date:
Jan 2004
Location:
N of San Antonio TX
Posts:
9,791
Plugin Contributions:
14

Re: GA-4 Analytics [Support Thread]

You'll need to find which of the Google Tag Manager IDs belongs with the current site and remove the non-current.

While it probably doesn't affect site performance, Google does not recommend having more than one gtag.

3 Apr 2025, 6:40 AM
#48
shop_suey avatar

shop_suey

Zen Follower

Join Date:
Feb 2014
Location:
Germany
Posts:
375
Plugin Contributions:
0

Re: GA-4 Analytics [Support Thread]

dbltoe:

You'll need to find which of the Google Tag Manager IDs belongs with the current site and remove the non-current.

While it probably doesn't affect site performance, Google does not recommend having more than one gtag.

What Google exactly says is:

*keep the number of tags [...] as lean as possible

Most browsers will not open more than four to eight HTTP requests to a single domain at a time. If you have a high number of tags on the same domain firing under the same conditions, tags will only fire within this browser limitation.*

https://support.google.com/tagmanager/answer/2772488?hl=en-GB

3 Apr 2025, 7:39 PM
#49
nicksab avatar

nicksab

Totally Zenned

Join Date:
Apr 2011
Posts:
592
Plugin Contributions:
0

Re: GA-4 Analytics [Support Thread]

dbltoe:

You'll need to find which of the Google Tag Manager IDs belongs with the current site and remove the non-current.

While it probably doesn't affect site performance, Google does not recommend having more than one gtag.

Shop Suey:

What Google exactly says is:

*keep the number of tags [...] as lean as possible

Most browsers will not open more than four to eight HTTP requests to a single domain at a time. If you have a high number of tags on the same domain firing under the same conditions, tags will only fire within this browser limitation.*

https://support.google.com/tagmanager/answer/2772488?hl=en-GB

Thank you both for the prompt assist.

I am only using the G4-Analytics plug in.

As you can see in the page source, the gtag id is the same in both location.

<script async src="https://www.googletagmanager.com/gtag/js?id=G-JQL28SP4BW"></script>
<script>
    window.dataLayer = window.dataLayer || [];
    function gtag(){dataLayer.push(arguments);}
    gtag('js', new Date());
    gtag('config', 'G-JQL28SP4BW');
</script>
 <meta charset="utf-8">
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-JQL28SP4BW"></script>

I made a test ( maybe pointless) but oddly if i change the gtag ID in the G4 Anlytic admin setting, the ID changes in both places.

I may just uninstall G4-anyltics to see if the script is still loaded. Not sure why the script would be loaded twice on the same page

4 Apr 2025, 5:01 AM
#50
carlwhat avatar

carlwhat

zennedOut

Join Date:
Nov 2005
Location:
los angeles
Posts:
2,958
Plugin Contributions:
8

Re: GA-4 Analytics [Support Thread]

nicksab:

Thank you both for the prompt assist.
...

i love your response... although...

TIS.

nicksab:

...
Not sure why the script would be loaded twice on the same page

nick,
my 1st guess would be that potentially you have the same notifier in 2 places. why you would have that, i do not know.

i can only assume that @lat9 has tested this module, and that in a normal install, the behavior you are witnessing does not happen.

given that assumption, i would search your code base for:

NOTIFY_HTML_HEAD_TAG_START

that is the notifier that places your tag in the header. if that notifier occurs in 2 places that would explain the behavior.

your test (hardly pointless) suggests that the code where the tag gets inserted is getting hit twice.

but you definitely have some sort of issue, that i'm guessing is with your template.

in any event, that is where i would start.

best.

6 Apr 2025, 1:10 AM
#51
nicksab avatar

nicksab

Totally Zenned

Join Date:
Apr 2011
Posts:
592
Plugin Contributions:
0

Re: GA-4 Analytics [Support Thread]

carlwhat:

i love your response... although...

TIS.

nick,
my 1st guess would be that potentially you have the same notifier in 2 places. why you would have that, i do not know.

i can only assume that @lat9 has tested this module, and that in a normal install, the behavior you are witnessing does not happen.

given that assumption, i would search your code base for:

NOTIFY_HTML_HEAD_TAG_START

that is the notifier that places your tag in the header. if that notifier occurs in 2 places that would explain the behavior.

your test (hardly pointless) suggests that the code where the tag gets inserted is getting hit twice.

but you definitely have some sort of issue, that i'm guessing is with your template.

in any event, that is where i would start.

best.

I could totally give you a hug right now.

I did a search as suggested and turns out the code got somehow duplicated:

/includes/templates/royal_fleur/common/html_header.php

Line # 68 : $zco_notifier->notify('NOTIFY_HTML_HEAD_TAG_START', $current_page_base);

Line # 75 : $zco_notifier->notify('NOTIFY_HTML_HEAD_TAG_START', $current_page_base);

Thank you for the help as always.

6 Apr 2025, 3:52 AM
#52
carlwhat avatar

carlwhat

zennedOut

Join Date:
Nov 2005
Location:
los angeles
Posts:
2,958
Plugin Contributions:
8

Re: GA-4 Analytics [Support Thread]

:thumbsup:

18 Jul 2025, 7:35 PM
#53
chuckrey avatar

chuckrey

Zen Follower

Join Date:
Aug 2020
Location:
Richarson
Posts:
160
Plugin Contributions:
0

Re: GA-4 Analytics [Support Thread]

Hi,
I have a google Ads Tracking ID starting with "AW". The readme file specifically states the id starts with a G. Can you please tell me if this plugin will accommodate my tracking ID starting with "AW".

Thanks!

19 Jul 2025, 12:22 PM
#54
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,086
Plugin Contributions:
56

Re: GA-4 Analytics [Support Thread]

chuckrey:

Hi,
I have a google Ads Tracking ID starting with "AW". The readme file specifically states the id starts with a G. Can you please tell me if this plugin will accommodate my tracking ID starting with "AW".

Thanks!
Actually, the readme indicates that the id can start with either G- or GTW-. I believe that your Google management-console provides a means to connect the GA-4 measurement ID to your Ads Tracking ID (AW-), but that's outside the scope of this plugin.

22 Jul 2025, 10:37 PM
#55
chuckrey avatar

chuckrey

Zen Follower

Join Date:
Aug 2020
Location:
Richarson
Posts:
160
Plugin Contributions:
0

Re: GA-4 Analytics [Support Thread]

lat9:

Actually, the readme indicates that the id can start with either G- or GTW-. I believe that your Google management-console provides a means to connect the GA-4 measurement ID to your Ads Tracking ID (AW-), but that's outside the scope of this plugin.

Ok, Thank you so much for your response. :smile:

23 Aug 2025, 12:57 PM
#56
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,086
Plugin Contributions:
56

Re: GA-4 Analytics [Support Thread]

v2.0.2 of "GA4 Analytics" is now available for download: https://www.zen-cart.com/downloads.php?do=file&id=2368

This release contains changes associated with these GitHub issues:

#29: Correct PHP warnings for 'missing' products_name.
#30: Call-back to parent methods for plugin install/upgrade/uninstall.

1 Oct 2025, 6:22 AM
#57
dml73 avatar

dml73

Zen Follower

Join Date:
Oct 2007
Posts:
413
Plugin Contributions:
0

Re: GA-4 Analytics [Support Thread]

I'm a bit confused regarding the GA4 Analytics plugin v2.0.1.

Under "Choose item_id Parameter Value" it says:

Attachment 21054

Shouldn't it be "ID" instead of "Model"? Like this:

"When products are included in GA4 events, what value should be used for the item_id parameter? If you choose products_id, the product's ID (if that value is not empty) is placed into the field name you identify below. Default: products_model."

Or am I misunderstanding?

Isn't this parameter for selecting either to send the product's model number or the product's ID number to GA4?

1 Oct 2025, 10:57 AM
#58
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,086
Plugin Contributions:
56

Re: GA-4 Analytics [Support Thread]

DML73:

I'm a bit confused regarding the GA4 Analytics plugin v2.0.1.

Under "Choose item_id Parameter Value" it says:

Attachment 21054

Shouldn't it be "ID" instead of "Model"? Like this:

"When products are included in GA4 events, what value should be used for the item_id parameter? If you choose products_id, the product's ID (if that value is not empty) is placed into the field name you identify below. Default: products_model."

Or am I misunderstanding?

Isn't this parameter for selecting either to send the product's model number or the product's ID number to GA4?
This parameter identifies the unique value used to identify the product to the analytics. If all your products' models are unique, use products_model; otherwise, use products_id.

1 Oct 2025, 12:45 PM
#59
dml73 avatar

dml73

Zen Follower

Join Date:
Oct 2007
Posts:
413
Plugin Contributions:
0

Re: GA-4 Analytics [Support Thread]

Thanks for the clarification. However the reason I ask is because I'm getting an error in my Google Ads tracking:

"Many recent conversions have sold item IDs that can't be matched to Merchant Center"

Attachment 21055

When I search Google troubleshooting, they say:

Attachment 21056

Does that mean that I have to enter items.item_id or items.id into the "Choose products_model Field Name" field? Instead of the default ep.item_model.

1 Oct 2025, 1:48 PM
#60
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,086
Plugin Contributions:
56

Re: GA-4 Analytics [Support Thread]

It "sounds like" you've got your merchant center set up based on products' id values, not models. If so, set that configuration value to use the products_id.