Analytics
6.6K members online now
6.6K 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

Need help with code implementation

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

Dear Google Team,

 

We have Google analytics code is with us with custom dimensions which is already running in our website the google analytics code running in our website splits (divided) in two parts as highlighted bellow.

 

Now we have merged the google analytics code and custom dimensions in to single code. we would like to have your advise / opinion about merged code and split code implementation in our website. which code we should go ahead for implementation please suggest.  

 

Code currently running in website:-

<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');
</script>

<!-- taboola Story added by anyone on 24-06-2014 -->
<script>
window._newsroom = window._newsroom || [];
!function (e, f, u) {
e.async = 1;
e.src=u;
f.parentNode.insertBefore(e, f);
}(document.createElement('script'),
document.getElementsByTagName('script')[0], '//c2.example.com/nr/example-example/newsroom.js');
</script>
<title>abcd</title>
<meta name="description" content="abcd." />
<meta name="news_keywords" content="abcd" />
<meta name="twitter:card" content="summary" />
<meta name="twitter:site" content="@example" />
<meta name="twitter:creator" content="@example" />
<meta name="twitter:url" content="http://example.in/" />
<meta name="twitter:title" content="abcd" />
<meta name="twitter:description" content="abcd" />
<meta name="twitter:image" content="http://media2.example.in/abcd/images/stories/022016/trai_650_020816051343.jpg" />
<meta name="robots" content="index, follow" />
<meta name="dc.language" content="hi" />
<link rel="canonical" href="http://example.in/" />
<script type='text/javascript'> ga('create', 'UA-xxxxx-x', 'auto');
ga('set', 'dimension1', 'example.in [Edited By: Name]');ga('set', 'dimension2', 'country');ga('set', 'dimension3', 'news'); ga('send', 'pageview'); </script>

 

Updated code we want to implement:-

<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-xxxxx-x', 'auto');

ga('set', 'dimension1', 'example.in [Edited by: name]');ga('set', 'dimension2', 'country');ga('set', 'dimension3', 'news');

  ga('send', 'pageview');

 

</script>

 

Re: Need help with code implementation

Follower ✭ ✭ ✭
# 2
Follower ✭ ✭ ✭