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

Customized GA code with client prefix

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hi, trying to set-up tracking for the website with integrated 3-rd party reservation systems. Received from them customized tracking code ( below) but after implementation, I can only see data from the reservation system, but nothing from the website.

After checking with Google Tag Assistant, I got the message: "Invalid or missing web property ID"- but the code is there

this is complete code:

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript">

(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');

   var tbb_ga = '<UA-72323218-1>';
   var tbb_cid = '<7-days-premium-linz>';
   var tbb_domain = 'www.thebookingbutton.co.uk';

   ga('create', tbb_ga, {'allowLinker': true});
   ga('require', 'linker');
   ga('linker:autoLink', [tbb_domain]);
   ga('send', 'pageview');

   ga(function(tracker) {
      window.linker = window.linker || new window.gaplugins.Linker(tracker);
     if(document.referrer.indexOf(document.domain)!=7) {
       var e = document.createElement('iframe');
       e.src=window.linker.decorate('//'+tbb_domain+'/'+tbb_cid+'/ga_proxy');
       e.setAttribute('style', 'display:none');
       var b = document.getElementsByTagName('body')[0];
       b.appendChild(e);
      }
   });

   // Automatically apply TBB prefix to thebookingbutton links
   $(document).ready(function(){
     $('a[href*="'+tbb_domain+'"]').each(function(){
         this.href = this.href.replace(new RegExp(tbb_domain+'/properties', 'i'), tbb_domain+'/'+tbb_cid+'/properties');
     });
   });
</script>
1 Expert replyverified_user

Re: Customized GA code with client prefix

Top Contributor
# 2
Top Contributor
Hi,

To fix the issue please change:
var tbb_ga = '<UA-72323218-1>';
to:
var tbb_ga = 'UA-72323218-1';

Hope this helps.

Arnold Majlath, Google Analytics Top Contributor
Was my response helpful? If yes, please accept it as solution.
Circle Me On Google+ | Visit me @ Redfly Digital

Re: Customized GA code with client prefix

A T
Participant ✭ ✭ ✭
# 3
A T
Participant ✭ ✭ ✭
Hi,

Moving forward
You can easily debug on the website with GA debugger:
https://chrome.google.com/webstore/detail/jnkmfdileelhofjcijamephohjechhna

You can check in chrome, console tab with 'Preserve log' turned ON.

Best Regards,
GA Guru.

'Star' or 'Accept as Solution' if it helped.