Web based family history software

question-circle Question Analytics (GA4) integration

  • ChrisAndersen
  • ChrisAndersen's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Greetings from Århus, Denmark
More
1 year 8 months ago #1 by ChrisAndersen
Analytics (GA4) integration was created by ChrisAndersen
How to I integrate GA4 in webtrees 1.7.17?

tried it here but there is only a UA- syntax possible:
../admin_site_config.php?action=tracking

In which directory and file (on my ftp-server) do I find the overall header tag for all pages?
Then I would integrate the GA4-Tag there.

genroot.me/1 (blushing)
================
(wt 1.7.17 | php 7.3 | wt 2.1.16 on testserver)

Please Log in or Create an account to join the conversation.

More
1 year 8 months ago #2 by fisharebest
Replied by fisharebest on topic Analytics (GA4) integration
There is a module "Custom CSS and JS" available for webtrees 1.7.

It will allow you to insert ht GA4 code snippet.

webtrees.net/download/modules

Greg Roach - greg@subaqua.co.uk - @fisharebest@phpc.social - fisharebest.webtrees.net

Please Log in or Create an account to join the conversation.

  • ChrisAndersen
  • ChrisAndersen's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Greetings from Århus, Denmark
More
1 year 8 months ago #3 by ChrisAndersen
Replied by ChrisAndersen on topic Analytics (GA4) integration
Works - Thanks :-)

genroot.me/1 (blushing)
================
(wt 1.7.17 | php 7.3 | wt 2.1.16 on testserver)

Please Log in or Create an account to join the conversation.

  • ChrisAndersen
  • ChrisAndersen's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Greetings from Århus, Denmark
More
1 year 8 months ago - 1 year 8 months ago #4 by ChrisAndersen
Replied by ChrisAndersen on topic Analytics (GA4) integration
hmm... I thought it works... but click on the link in the signature...
the database is just loading forever and when I de-install this Custom Javascript module the website is working again.

What I did...
- saved the module Custom Javascript via FTP in directory: /modules_v3
- checked the modul in the admin dashboard under modules
- added the Google Analytics 4 JavaScript tag (long version)

What am I doing wrong?

genroot.me/1 (blushing)
================
(wt 1.7.17 | php 7.3 | wt 2.1.16 on testserver)
Last edit: 1 year 8 months ago by ChrisAndersen.

Please Log in or Create an account to join the conversation.

More
1 year 8 months ago #5 by Franz Frese
Replied by Franz Frese on topic Analytics (GA4) integration
So you should have a closer look into your module.

Wie sollten wir, ohne den Code zu kennen, einen Tipp geben können. Wir haben keine Kristallkugel.

Please Log in or Create an account to join the conversation.

More
1 year 8 months ago #6 by ddrury
Replied by ddrury on topic Analytics (GA4) integration
did you wrap your code in the script tags? ie.

<script>

your code

</script>

What do you see in the browser debug console?

--
Dave

Local: Win 11 Pro, WSL2/Ubuntu20.04.4, Apache 2.4.51, PHP 7.4.26/8.1.7, MySQL 8.0.27
Production: Litespeed 8.0.1, PHP 8.1.9, MySQL 8.0.26

Please Log in or Create an account to join the conversation.

  • ChrisAndersen
  • ChrisAndersen's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Greetings from Århus, Denmark
More
1 year 8 months ago #7 by ChrisAndersen
Replied by ChrisAndersen on topic Analytics (GA4) integration
thx for the answer :-)

I have attached the code I inserted into the Google analytics module.

genroot.me/1 (blushing)
================
(wt 1.7.17 | php 7.3 | wt 2.1.16 on testserver)
Attachments:

Please Log in or Create an account to join the conversation.

  • ChrisAndersen
  • ChrisAndersen's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Greetings from Århus, Denmark
More
1 year 8 months ago #8 by ChrisAndersen
Replied by ChrisAndersen on topic Analytics (GA4) integration
thx for the answer.
I attached the debug info.

genroot.me/1 (blushing)
================
(wt 1.7.17 | php 7.3 | wt 2.1.16 on testserver)
Attachments:

Please Log in or Create an account to join the conversation.

More
1 year 8 months ago #9 by fisharebest
Replied by fisharebest on topic Analytics (GA4) integration
Can you post a screenshot of what you've entered into the CSS/JS module.

You've got something wrong in there. It's hard to say without actually seeing it.

Greg Roach - greg@subaqua.co.uk - @fisharebest@phpc.social - fisharebest.webtrees.net

Please Log in or Create an account to join the conversation.

More
1 year 8 months ago - 1 year 8 months ago #10 by Franz Frese
Last edit: 1 year 8 months ago by Franz Frese.

Please Log in or Create an account to join the conversation.

  • ChrisAndersen
  • ChrisAndersen's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Greetings from Århus, Denmark
More
1 year 8 months ago - 1 year 8 months ago #11 by ChrisAndersen
Replied by ChrisAndersen on topic Analytics (GA4) integration
Thx for reposting my attachment more visible :-)
I just pasted the GA4 code into the module's box.

genroot.me/1 (blushing)
================
(wt 1.7.17 | php 7.3 | wt 2.1.16 on testserver)
Last edit: 1 year 8 months ago by ChrisAndersen.

Please Log in or Create an account to join the conversation.

More
1 year 8 months ago - 1 year 8 months ago #12 by fisharebest
Replied by fisharebest on topic Analytics (GA4) integration
Your error message says there is an unexpected "<" at line 55.

All the "<" in your screenshot look OK.

Perhaps it is caused by some other JS code.

Look at the source of the page, and examine the lines around 55.

Greg Roach - greg@subaqua.co.uk - @fisharebest@phpc.social - fisharebest.webtrees.net
Last edit: 1 year 8 months ago by fisharebest.

Please Log in or Create an account to join the conversation.

More
1 year 8 months ago #13 by fisharebest
Replied by fisharebest on topic Analytics (GA4) integration
I just realised that the URL of your site is in your profile, so I can take a look.

You are using the fancy treeview module.

The JS for this module is immediately before your JS.

But it does not have a closing </script>

It's a bug in that module. Are you using the latest version of it?

If so, then maybe you could work around it by adding "</script>" to the start of your custom JS.

Greg Roach - greg@subaqua.co.uk - @fisharebest@phpc.social - fisharebest.webtrees.net

Please Log in or Create an account to join the conversation.

  • ChrisAndersen
  • ChrisAndersen's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Greetings from Århus, Denmark
More
1 year 8 months ago - 1 year 8 months ago #14 by ChrisAndersen
Replied by ChrisAndersen on topic Analytics (GA4) integration
Added your recommended tag before the GA4 tag and the page works fine, again. :-)
Great help from you all... thanks so much.

genroot.me/1 (blushing)
================
(wt 1.7.17 | php 7.3 | wt 2.1.16 on testserver)
Last edit: 1 year 8 months ago by ChrisAndersen.

Please Log in or Create an account to join the conversation.

Powered by Kunena Forum