Skip Navigation

This thread is resolved. Here is a description of the problem and solution.

Problem:
You want to set up Google Analytics 4 (GA4) to track different languages on your website for a specific country, such as Poland, but are unsure where to place the GA4 code.
Solution:
1. If you are using a single domain for multiple languages, it's important to note that placing different GA4 codes for each language might not be directly supported by Google as it is intended for different websites or domains, not languages. You should consult with a specialist to ensure compliance with Google's guidelines.
2. If your setup involves different domains per language, you can implement separate GA4 codes for each domain. For guidance on setting up GA4 analytics using different domains per language, visit https://wpml.org/forums/topic/how-to-setup-ga4-analytics-using-different-domain-per-language/.
3. Consider using a third-party plugin that supports WPML and is capable of tracking analytics data by country. While we do not recommend specific plugins, any good analytics plugin should be able to differentiate visitors from different countries.

Please note that the solution provided might be outdated or not applicable to your specific case. If these steps do not resolve your issue, we highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If further assistance is needed, please open a new support ticket at WPML support forum.

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

Tagged: 

This topic contains 5 replies, has 0 voices.

Last updated by Dražen 2 months, 1 week ago.

Assisted by: Dražen.

Author Posts
February 11, 2025 at 2:11 am #16689784

theppachatS

Background of the issue:
I want to set up Google Analytics 4 to track different languages on my website, specifically for a particular country. I have the GA4 code and want to set it up for Poland on this website: hidden link

Symptoms:
I am unsure where to place the GA4 code for a specific country.

Questions:
How do I set up Google Analytics 4 to track different languages?
Where should I place the GA4 code for a specific country, like Poland?

February 11, 2025 at 8:19 am #16690224

Dražen
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hello,

if you are using the same domain, I do not know if this is possible and would cause any issue with Google, since it is intended for the same websites/ domain, not languages. The best would be to check with a specialist.

Other than that you can use simple code and add different Google Analytics codes for each language/ domain if you are using domain per language as suggested above:

- https://wpml.org/forums/topic/how-to-setup-ga4-analytics-using-different-domain-per-language/

Please we do not support or provide custom code, shared above is just a simple example of code that you can use and might need further adaption.

Kind regards,
Drazen

February 14, 2025 at 1:42 am #16704805

theppachatS

How are the possible ways to collect user data by country for a single-domain website using WPML?

Thank you.

February 14, 2025 at 7:12 am #16705072

Dražen
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hello,

You should use 3rd party plugin that supports this, as I understand any analytics should be able to tell different country visitors. Best I can advise is to use analytics and follow data that it shows. This is the same for with WPML and without.

Regards,
Drazen

February 17, 2025 at 2:01 am #16711543

theppachatS

Hello,

Can you recommend any 3rd-party plugins that support WPML and work for this type of case?

By the way, have other clients had similar cases?
How did they manage to use analytics to track data for each country?

Thank you.

February 17, 2025 at 7:18 am #16711753

Dražen
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hello,

as said I think any should track visitors from different countries. You can use Google analytics and it should tell data from different visitors.

Regards,
Drazen