Please make sure to update to WPML 4.3.5 and check our list of Known Issues before reporting

Hi, Amit here, I am the WPML Support Manager, our current ticket queue is high, update your WPML plugins and make sure you meet the minimal requirements for running WPML before reporting an issue please - many tickets are resolved doing that

Please look at our updated list of Known Issues and you can also use our support search to find helpful information and of course review our documentation before opening a ticket.

If you do need to open a ticket please make sure to provide us with all the needed information as described in this page

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 3 replies, has 2 voices.

Last updated by Bobby 1 month, 1 week ago.

Assigned support staff: Bobby.

Author Posts
October 25, 2019 at 7:27 pm #4829773

maxL-15

Hi, I don’t know where to go. I need to enable e-commerce tracking for all the domains in the root site .nl that is translated with WPML. For NL it is enabled, but Google Analytics doesn’t show ecommerce tracking for other domains.

Do you know what I can do to fix this? So that every domain has ecommerce tracking enabled?

October 26, 2019 at 8:46 pm #4832965

Bobby
Supporter

Languages: English (English )

Timezone: America/Los_Angeles (GMT-08:00)

Hi There,

Are you assigning the same account for both languages?

If yes then it is simple, since google can differentiate and all you have to do to verify that the tags exist in the translation is just to inspect the page, and you should be able to see the tags.

If you did want to use separate accounts for each language then I recommend following the instructions in the following thread

=>https://wpml.org/forums/topic/how-to-add-the-google-analytics-for-2-languages-domains/#post-891674

October 28, 2019 at 4:16 pm #4841591

maxL-15

The code you sent is only able to load a specific script for each language. What I need is to be able to enable e-commerce tracking for all languages.

If needed, I can use the same analytics account for all domains. Still, I wouldn't know how to enable e-commerce tracking for all domains then. Now it only works for .nl.

October 28, 2019 at 5:31 pm #4842139

Bobby
Supporter

Languages: English (English )

Timezone: America/Los_Angeles (GMT-08:00)

Hello,

I believe the way I have explained is the current way to achieve this at the moment.

Related Ticket:
https://wpml.org/forums/topic/google-analytics-wpml-compatible-plugin/#post-491365

The code I shared with you is custom code. You will need to further customize it in order to fit your needs, as this was to showcase the sample code you will need to base yours on.

The code uses an if elseif structure to keep adding your own languages by adding their language codes and then the script under each language code.

Example: If Englihs then run script for GA1 , Ifelse German run script for GA2, Ifelse Swiss run script for GA3, etc ...

I will break it down below so you can fully understand how to build yours to match your needs.

</strong>//This determines the language code 'en' for English 'es' for Spanish etc, you can see your language codes within WPML->Languages->Edit languages.</strong>

<?php if(ICL_LANGUAGE_CODE=='en'){?>
<strong>//Here you add your GA script from your GA Account</strong>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
   
ga('create', 'UA-326103-28', 'auto');
ga('send', 'pageview');
   
</script>
<strong>Same as above you now determine the code for the second language, simply copy and paste it again so you can keep adding the rest of the languages available in your site.</strong>
<?php } elseif(ICL_LANGUAGE_CODE=='nl'){?>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
   
ga('create', 'UA-326103-14', 'auto');
ga('send', 'pageview');
   
</script>
<?php } ?>

NOTE: DO not use the code above as I have added my comments on it if you decide to use it simply remove my comments.

The topic ‘[Closed] Google Analytics Ecommerce tracking’ is closed to new replies.