Skip Navigation

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.

This topic contains 4 replies, has 2 voices.

Last updated by joshuaP-3 3 years, 11 months ago.

Assisted by: Marcel.

Author Posts
April 30, 2021 at 3:06 pm #8663785

joshuaP-3

I would like to know what is the best / recommended way to set up Google Analytics with a site that displays two languages in separate domains. I have found conflicting information in the forum. Some posts suggest using code with separate analytics properties, while another post recommends using the same property with separate views.

May 3, 2021 at 10:03 am #8674645

Marcel
Supporter

Languages: English (English ) German (Deutsch )

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

Hi,

Thank you for contacting WPML Support.

Which method makes sense depends also on your business and marketing strategy. If you prefer to separate the stats for each domain completely, add 2 property IDs via code as mentioned here: https://wpml.org/forums/topic/how-to-add-the-google-analytics-for-2-languages-domains/#post-891674. This method is more asked here in our forum and many clients are integrating Google Analytics and even Google Tag Manager this way.

Here, you can find a good explanation of the Vies method: https://wpml.org/forums/topic/implement-google-analytics-on-mulitlanguage-wordpress-website/#post-1282022

Google itself describe the way of using different properties: hidden link

If you have further questions, I recommend getting in touch with a certified WPML consulter which offers SEO best practices: https://wpml.org/contractors/

Best Regards
Marcel

May 3, 2021 at 3:44 pm #8677937

joshuaP-3

I stilled the code in the footer of my site hidden link and hidden link, but I don't think it's working

I get 2 tag errors on both sites. So the analytics code is being generated on both. The error is No HTTP response detected

I'll attach screenshoots

2021-05-03_12-18-21.png
2021-05-03_12-17-22.png
May 3, 2021 at 4:10 pm #8678055

Marcel
Supporter

Languages: English (English ) German (Deutsch )

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

Hi,

Google itself recommends adding the integration to your site header: hidden link

As next, please try to add the code directly to your Child Theme, as I can't confirm if it works over a 3rd party Snippet plugin. The mentioned Browser Add-ons links this HTTP error to hidden link

Verify your code since this is a non-standard implementation.
We have detected that the Google Analytics tracking code on this page is a non-standard implementation.
Using non-standard code implementation on a page may prevent data from reporting into your Google Analytics account, and any associated data may be considered unreliable.
Solution: Verify that your code is set up properly as indicated by the tracking code given in your Google Analytics account.

If you need further help in this integration, please contact a certified WPML contractor, as custom coding is not part of our support policy.

Best Regards
Marcel

May 3, 2021 at 5:46 pm #8678679

joshuaP-3

Thanks. I was able to get it working after adding the code to the header.php of my child theme and copying over new google analytics tracking code.