AdWords is now Google Ads. Our new name reflects the full range of advertising options we offer across Search, Display, YouTube, and more. Learn more

Analytics
4.2K members online now
4.2K members online now
Dive into multiple domain (Cross/Sub) tracking, implementing Ecommerce and Enhanced Ecommerce, setting up Event tracking, and Universal Analytics code.
 
Guide Me
star_border
Reply

Same web property ID is tracked twice.

[ Edited ]
Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hi guys,

 

i have a question. Tag Assistant notes that same web property ID UA-xxxxxxxx-1 is tracked twice for our website ... can you please help me figure out where is the second code. 

 

We have a site with different languages. Each language has its own tracking code. 

But we'd also like to track website as a whole.

 

Currently i can see this code in our header.php file:

 

<?php if(ICL_LANGUAGE_CODE=='sl'){?>
<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-xxxxxxxx-1', 'auto');
ga('send', 'pageview');
</script>
<?php } elseif(ICL_LANGUAGE_CODE=='hr'){?>
<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-xxxxxxxx-2', 'auto');
ga('send', 'pageview');
</script>
<?php } elseif(ICL_LANGUAGE_CODE=='sr'){?>
<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-xxxxxxxx-3', 'auto');
ga('send', 'pageview');
</script>
<?php } elseif(ICL_LANGUAGE_CODE=='me'){?>
<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-xxxxxxxx-4', 'auto');
ga('send', 'pageview');
</script>
<?php } elseif(ICL_LANGUAGE_CODE=='bs'){?>
<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-xxxxxxxx-5', 'auto');
ga('send', 'pageview');
</script>
<?php } elseif(ICL_LANGUAGE_CODE=='en'){?>
<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-xxxxxxxx-6', 'auto');
ga('send', 'pageview');
</script>
<?php } elseif(ICL_LANGUAGE_CODE=='mk'){?>
<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-xxxxxxxx-7', 'auto');
ga('send', 'pageview');
</script>
<?php } elseif(ICL_LANGUAGE_CODE=='xk'){?>
<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-xxxxxxxx-9', 'auto');
ga('send', 'pageview');
</script>
<?php } ?>

 

 

Kind regards!

 

1 ACCEPTED SOLUTION

Accepted Solutions
Marked as Best Answer.
Solution
Accepted by topic author Datalab W
June 2017

Same web property ID is tracked twice.

[ Edited ]
Participant ✭ ✭ ☆
# 6
Participant ✭ ✭ ☆

Hi @Anja K ( @Datalab W ) Smiley Happy

 

I found the problem. The second Google Analytics is being triggered through your Google Tag Manager(Container Id: KS***T).

Also, your page is not only being tracked twice but also you are sending data to UA-xxxx-1 property in other versions(.ba, .me, .eu ..) of your website. It is because you have the same Google Tag Manager container on that websites.

 

If you remove your trigger from Universal Analytics tag in GTM, it will be working fine.

 

I hope this helps to solve your issue. Please let me know if you have any questions.

 

Regards,

Güney

View solution in original post

Same web property ID is tracked twice.

Participant ✭ ✭ ☆
# 2
Participant ✭ ✭ ☆

Hi @Datalab W,

 

If you want to use multiple Google Analytics accounts on the same website, you should use named trackers otherwise you will have inaccurate(duplicated) data.

 

So, your google analytics tracking snippet should look like as following:

<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','https://www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-1XXXXXX3-1', 'auto');
ga('create', 'UA-1XXXXXX3-2', 'auto', 'mySecondGA'); // This is your named tracker that is named as 'mySecondGA' . You can name it as you wish.

ga('send', 'pageview');
ga('mySecondGA.send', 'pageview');
</script>

 

 

 

I hope this helps to solve your problem.

Regards

Same web property ID is tracked twice.

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭

Well we don't have multiple GA Accounts.

 

We have different GA codes for each language version of the webpage.

Hence the language code classification.

 

With your code how do i command the code to track pageviews on a specific version of the website?

 

The code i posted works perfectly for all of the languages exept for the language with UA-xxxxxxxx-1 code. It appears this one is tracked twice.

Same web property ID is tracked twice.

Participant ✭ ✭ ☆
# 4
Participant ✭ ✭ ☆

Hi @Datalab W,

 

I got your point. By the way, I meant property by saying account. When your website is being tracked twice, this means you have more than one Google Analytics tracking snippet on your pages (or duplicated pageview commands). If you can give us your url, I can take a look for you.

 

Regards

Same web property ID is tracked twice.

Visitor ✭ ✭ ✭
# 5
Visitor ✭ ✭ ✭

Hi,

 

This would be great. Please see if you can find the problem: www.datalab.si 

 

Best regards

Marked as Best Answer.
Solution
Accepted by topic author Datalab W
June 2017

Same web property ID is tracked twice.

[ Edited ]
Participant ✭ ✭ ☆
# 6
Participant ✭ ✭ ☆

Hi @Anja K ( @Datalab W ) Smiley Happy

 

I found the problem. The second Google Analytics is being triggered through your Google Tag Manager(Container Id: KS***T).

Also, your page is not only being tracked twice but also you are sending data to UA-xxxx-1 property in other versions(.ba, .me, .eu ..) of your website. It is because you have the same Google Tag Manager container on that websites.

 

If you remove your trigger from Universal Analytics tag in GTM, it will be working fine.

 

I hope this helps to solve your issue. Please let me know if you have any questions.

 

Regards,

Güney

Same web property ID is tracked twice.

Visitor ✭ ✭ ✭
# 7
Visitor ✭ ✭ ✭

Thank you so much Güney!

 

 

Same web property ID is tracked twice.

Participant ✭ ✭ ☆
# 8
Participant ✭ ✭ ☆

You're welcome! Smiley Happy