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 Raja Mohammed 8 months ago.

Assigned support staff: Raja Mohammed.

Author Posts
February 15, 2019 at 12:28 pm #3204774

oscarL-12

Tell us what you are trying to do?
Hello there,

I am trying to implement Google Analytics to trace two languages which are on two different TLD and domains.

[EN] site - hidden link
[LT] site - hidden link

I need to have two different Google Analytics codes tracking those sites separately.

Thanks in advance,
Regards

February 15, 2019 at 1:57 pm #3205187

Raja Mohammed
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hi There,

Welcome to our forum,

You can add a code like the one below in your theme (child theme) functions.php file

add_action('wp_head','ga_analytics_ln',11);
  
function ga_analytics_ln() {
 
if(ICL_LANGUAGE_CODE=='en') { 
    ?>
    <!-- Google Analytics  Code for English site goes here-->
     
 
    <?php } elseif(ICL_LANGUAGE_CODE=='lt') { ?>
 
    <!-- Google Analytics  Code for lituanian site goes here-->
<?php } 
}

I hope this solved your issue.

Kind regards,
Raja

February 15, 2019 at 6:57 pm #3206424

oscarL-12

Hi Raja,

It doesn't seem to resolve the problems, as Google Analytics is not showing real time reporting, so it seems to be not collecting data.

Regards,

February 18, 2019 at 5:39 am #3210224

Raja Mohammed
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hi,

I am unable to figure out the google analytics code in your site, Can you please share me the code snippet you are using or a screenshot of the code and where the code is placed. Please share me temporary access to your site. I have enabled private fields for you to securely share the information.

Kind regards,
Raja

February 18, 2019 at 11:32 am #3211746

Raja Mohammed
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hi,

Since you are using Avada, you can add the code from AVADATheme options.
Please remove the code from the functions.php file.

I have added the tracking script for each language from Avada > Theme Options > Advanced > Code fields (Tracking) > Tracking Code . You can add the script for each language by changing the language from the top admin ribbon.

After adding the code the code is rendered in the site.

I hope this solves your issue.

Kind regards
Raja