GA-4 Analytics [Support Thread]
Re-creating the support thread, since the original one "went missing".
The GA-4 Analytics plugin (available at https://www.zen-cart.com/downloads.php?do=file&id=2368) can be used on Zen Cart sites using 1.5.6b through 1.5.8 without issue. For 1.5.6b installations (or non-standard/older templates), be sure to read the readme since there are a couple of notifications that must be added to template files for the GA-4 Analytics' observer class to do its thing.
Other than that, no core file overwrites, just a couple of configuration settings in your admin.
Re: GA-4 Analytics [Support Thread]
Small problem on account history info page; issue created in Github wi/log.
Re: GA-4 Analytics [Support Thread]
Users of older GA plugins may wish to delete the entry under Admin > Configuration for Universal Analytics. For Simple GA it can be done by removing
admin/includes/extra_datafiles/google_analytics_database_names.php
Re: GA-4 Analytics [Support Thread]
Quote:
Originally Posted by
swguy
Users of older GA plugins may wish to delete the entry under Admin > Configuration for Universal Analytics. For Simple GA it can be done by removing
admin/includes/extra_datafiles/google_analytics_database_names.php
Thanks, @swguy. I'll add this to the plugin's documentation.
Re: GA-4 Analytics [Support Thread]
Hi,
I have just yesterday installed ZC 1.5.8a and GA4.
I have found many DEBUG files in log directory.
All errors are this form:
[29-Mar-2023 16:22:41 UTC] Request URI: /index.php?main_page=product_reviews_write&products_id=11, IP address: 65.108.2.171, Language id CZK
#0 /pub/amforawa/vialux.cz/web/www/includes/classes/observers/class.ga4_analytics.php(79): zen_debug_error_handler()
#1 /pub/amforawa/vialux.cz/web/www/includes/autoload_func.php(47): ga4_analytics->__construct()
#2 /pub/amforawa/vialux.cz/web/www/includes/application_top.php(237): require('...')
#3 /pub/amforawa/vialux.cz/web/www/index.php(25): require('...')
--> PHP Warning: Undefined array key "currency" in /pub/amforawa/vialux.cz/web/www/includes/classes/observers/class.ga4_analytics.php on line 79.
on the row 79 in the ga4_analytics.php is this code:
$this->currency_decimal_places = $currencies->currencies[$_SESSION['currency']]['decimal_places'];
I find this code right, but understand what is wrong.
$_SESSION['currency'] is "CZK" and the decimal_places is ind the DB set to 2.
when I change the row 79 to this, it will works
$this->currency_decimal_places = 2;
so the problem is in the class Currencies, but I don't understav why.
can you help me?
than k you Dalibor
Re: GA-4 Analytics [Support Thread]
I have also seen this on one site (but not others). My workaround was to force-set that variable.
Re: GA-4 Analytics [Support Thread]
Quote:
Originally Posted by
Borek
Hi,
I have just yesterday installed ZC 1.5.8a and GA4.
I have found many DEBUG files in log directory.
All errors are this form:
[29-Mar-2023 16:22:41 UTC] Request URI: /index.php?main_page=product_reviews_write&products_id=11, IP address: 65.108.2.171, Language id CZK
#0 /pub/amforawa/vialux.cz/web/www/includes/classes/observers/class.ga4_analytics.php(79): zen_debug_error_handler()
#1 /pub/amforawa/vialux.cz/web/www/includes/autoload_func.php(47): ga4_analytics->__construct()
#2 /pub/amforawa/vialux.cz/web/www/includes/application_top.php(237): require('...')
#3 /pub/amforawa/vialux.cz/web/www/index.php(25): require('...')
--> PHP Warning: Undefined array key "currency" in /pub/amforawa/vialux.cz/web/www/includes/classes/observers/class.ga4_analytics.php on line 79.
on the row 79 in the ga4_analytics.php is this code:
$this->currency_decimal_places = $currencies->currencies[$_SESSION['currency']]['decimal_places'];
I find this code right, but understand what is wrong.
$_SESSION['currency'] is "CZK" and the decimal_places is ind the DB set to 2.
when I change the row 79 to this, it will works
$this->currency_decimal_places = 2;
so the problem is in the class Currencies, but I don't understav why.
can you help me?
than k you Dalibor
i disagree. i think the problem is with your $_SESSION['currency'] var. the error is saying that array value is not set.
if one looks at when the currencies get set, it is at load point 120.
the ga-4 analytics code gets set at load point 90.
the ga-4 analytics needs to be loaded AFTER the currencies get loaded in order that the currency value of the SESSION array is available.
best.
Re: GA-4 Analytics [Support Thread]
Agreed, @carlwhat, GitHub issue opened: https://github.com/lat9/ga4-analytics/issues/13
The issue can be corrected via edit to /includes/auto_loaders/config.ga4_analytics.php, changing this section
Code:
$autoLoadConfig[90][] = [
'autoType' => 'class',
'loadFile' => 'observers/class.ga4_analytics.php'
];
$autoLoadConfig[90][] = [
'autoType' => 'classInstantiate',
'className' => 'ga4_analytics',
'objectName' => 'ga4_analytics'
];
to read
Code:
$autoLoadConfig[120][] = [
'autoType' => 'class',
'loadFile' => 'observers/class.ga4_analytics.php'
];
$autoLoadConfig[120][] = [
'autoType' => 'classInstantiate',
'className' => 'ga4_analytics',
'objectName' => 'ga4_analytics'
];
Re: GA-4 Analytics [Support Thread]
Re: GA-4 Analytics [Support Thread]
Yes, thanks.
There I don't search the problem.
I have set the index as the last one that I have in my config.core.php
have a nice day
Borek