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.

Our next available supporter will start replying to tickets in about 0.17 hours from now. Thank you for your understanding.

This topic contains 3 replies, has 4 voices.

Last updated by marcelR-18 4 years, 11 months ago.

Assisted by: Bruno.

Author Posts
November 25, 2019 at 7:13 pm #5016485

marekK-11

I have WPML multiple domain website. sk,at,eu,hu in 4 languages.

I am really struggling how to setup Google Tag manager for each separate GA account for every domain.

I tried to google but didn't find nice solutions or guide. Here in this video tutorial he is saying that Cross Domain Tracking is not for 4 different GA accounts.

What is the best way to do this? I want to use also remarketing and FB pixel same way. Or any beer solution with WPML? Thanks

Mike

November 26, 2019 at 3:30 pm #5023065

Bruno

Thank you for contacting us. You must use the ICL_LANGUAGE_CODE constant to add a code for each language. For example, in your theme's footer.php you could use:

<?php if( ICL_LANGUAGE_CODE == 'sk' ): ?>

<!-- Insert the SK code (Google, Facebook, etc) -->

<?php elseif( ICL_LANGUAGE_CODE == 'at' ): ?>

<!-- Insert the AT code (Google, Facebook, etc) -->

<?php elseif( ICL_LANGUAGE_CODE == 'eu' ): ?>

<!-- Insert the EU code (Google, Facebook, etc) -->

<?php elseif( ICL_LANGUAGE_CODE == 'hu' ): ?>

<!-- Insert the HU code (Google, Facebook, etc) -->

<?php else: ?>

<!-- Insert the "global" code (Google, Facebook, etc) -->

<?php endif; ?>

If you are using a cache plugin, clear your site cache. This way, when the user accesses the URL in "sk", only the code defined within the "sk" block will be displayed.

Please, let me know if I can help with any other questions you may have about it. I'll be happy to help.

Thank you.

March 21, 2020 at 4:48 pm #5733663

jeroenV-58

Hi,

Shouldn't the GTM code be in the header, not in the footer??

June 23, 2020 at 10:07 am #6433377

marcelR-18

I know that this is marked as resolved however I wanted to point out that i found this useful however your else if statement is written wrong above :

<?php else if

should be

<?php elseif

No spaces, otherwise you receive a php error