• Home
  • Get help
  • Ask a question
Last post 8 hours 47 min ago
Posts last week 128
Average response time last week 28 min
All time posts 70382
All time tickets 10864
All time avg. posts per day 20

Helpdesk is open from Monday through Friday CET

Please create an (free) account to post any question in the support area.
Please check the development versions area. Look at the changelog, maybe your specific problem has been resolved already!
All tickets are private and they cannot be viewed by anyone. We have made public only a few tickets that we found helpful, after removing private information from them.

#8353 – Analytics need opt-in in Europe / how to edit the code?

Posted in ‘4SEO’
This is a public ticket. Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.
Thursday, 02 December 2021 13:19 UTC
coolcatcreations

Hi Yannick,

so currently I have to add Analytics Code like that:

<script type="text/plain" data-cookiefirst-category="advertising">
Code here

</script>

Is it possible to do this in 4SEO too? I think most of cookie consent providers need something like that.

Thanks :)

Elisa

Thursday, 02 December 2021 13:46 UTC
wb_weeblr

Hi

I think most of cookie consent providers need something like that.

Is it possible to do this in 4SEO too?

To do this, we would need to have plugins for each cookie consent provider, of which there are many, per country, made for Joomla or not, so 4SEO cannot do that right now. But having the ability to add custom attributes to the script tag is likely a nice option, I'll think about it.

As for now, you can:

- create a "Raw content" rule (SEO Tools | SEO rules, create a rule and select Raw content as the type). This lets you inject anything you want in various positions of the page (top of head, bottom of head, bottom of body, etc). You'll have to create the entire snippet.

- do an override: anything 4SEO outputs is done through JLayouts. For instance, for Google Analytics V4, you'll override the 'default.forseo.analytics.globalga_headtop' layout.

The original file is in /plugins/system/forseo/vendor/weeblr/forseo/layouts/default/forseo/analytics/globalga_headtop.php

- an alternative to that is to use a filter, which is like doing a layout override but in code only, without re-outputting the entire code snippet. I need to dig the details for that if a JLayout override is not convenient.

Best regards

Yannick Gaultier

weeblr.com / @weeblr

 

 

 
Thursday, 02 December 2021 14:24 UTC
coolcatcreations

Ok, thank you, I think the overrride is the best way :)

 

Thursday, 02 December 2021 14:52 UTC
wb_weeblr

To each their own :)

That said, I checked quickly how a filter would work instead and to achieve what you described above, all that's required is to add the following to the /library/weeblr/forseo_functions.php  file:

$hooks->add(
	'wblib_layout_default_forseo_analytics_universalga_headbottom',
	function ($renderedLayout, $data) {

		$renderedLayout = str_replace(
			'<script ',
			'<script type="text/plain" data-cookiefirst-category="advertising" ',
			$renderedLayout
		);

		return $renderedLayout;
	}
);

The benefits are:

- it will work regardless of the template you use (overrides are per template)

- if I update the analytics code (because Google changed it), you have to redo the override. The filter will still work as before

- no additional file to create and backup

Cheers

Yannick Gaultier

weeblr.com / @weeblr

 

 
Friday, 03 December 2021 14:20 UTC
coolcatcreations

Uhhh nice! Thank you :-)

Friday, 03 December 2021 14:24 UTC
wb_weeblr

Hi

You're welcome! Of course, there's always the drawback that these filters cannot be created/edited directly from within Joomla admin, contrary to templates overrides. I thought about creating a small plugin to do that, as the hooks system is shared across all our extensions but just could not find the time for it.

I see that you're making great progress with the German translations, thanks for that. It's a pretty big piece of software already, with lots of messages and text!

Best regards

Yannick Gaultier

weeblr.com / @weeblr

 

 
Friday, 03 December 2021 14:41 UTC
coolcatcreations

Hi Yannick,

oh yes it seems the strings get more and more instead of less :-D

 

Friday, 03 December 2021 14:43 UTC
wb_weeblr

Hi

I have actually removed one string this week :)

Best regards

Yannick Gaultier

weeblr.com / @weeblr

 

 
Monday, 03 January 2022 05:34 UTC
system
This ticket has been automatically closed. All tickets which have been inactive for a long time are automatically closed. If you believe that this ticket was closed in error, please contact us.
This ticket is closed, therefore read-only. You can no longer reply to it. If you need to provide more information, please open a new ticket and mention this ticket's number.