• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

AAC MyAcc - New Google analytics

T

tejdi

Guest
Does MyAcc work with the new google analytics? (GA4)
It shows that my website doesn't send any data (trying to access it from a phone on LTE and computer).
I've copied the code from GA4 and added it to the config, here:
PHP:
'google_analytics_id' => '',

However, the new code is in a different format.
Old GA code: UA-XXXXXXX-X
New GA code: G-XXXXXXXXXX
Post automatically merged:

Ok, looks like I've found a fix:

Find google_analytics.html.twig and paste:
HTML:
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id={{ config.google_analytics_id }}"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', '{{ config.google_analytics_id }}');
</script>

Then go to functions.php and find:
PHP:
if($type === 'head_start') {
and place under it:
PHP:
$ret .= template_ga_code();
then find:
PHP:
elseif($type === 'body_end') {
and comment out the line below:
PHP:
//$ret .= template_ga_code();

Enjoy your working GA4 :)
 
Last edited by a moderator:
what is this for?
Google Analytics is a web analytics service that provides statistics and basic analytical tools for search engine optimization (SEO) and marketing purposes. The service is part of the Google Marketing Platform and is available for free to anyone with a Google account.

Google Analytics allows you to make sense of the gathered data by converting into more comprehensive and appealing charts, graphs and spreadsheets. It allows you to effectively measure your web performance as you create relevant dashboards that are essential for achieving business goals.
 
Back
Top