Tracking scripts

Modified on: Fri, 2 Dec, 2022 at 10:05 AM

Print

Example of the tracking scripts

Clock PMS+ allow using of tracking scripts - Google Analytics, GTM, Yandex Metrica, etc.

Note: Read more about web tracking functionality from our support centre.

Google Analytics

Please, keep in mind that the UA=XXXXX-Y needs to refer to your G Analytics ID.

Default code in header:

<!-- Google Analytics -->
<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-XXXXX-Y', 'auto');
ga('send', 'pageview');
</script>
<!-- End Google Analytics -->

Google Analytics tag docs

Google Tag Manager with dynamic codes

Please, keep in mind that the GTM-XXXXXX need to refer to your GTM ID.

Last page code in header:

<script>
 window.addEventListener('load',function(){

 ga('require', 'ecommerce');
 
 ga('ecommerce:addTransaction', {
  'id': '{{booking_number}}',                     // Transaction ID.
  'affiliation': 'yourwebsite.com',   // Affiliation or store name.
  'revenue': {{booking_price}},               // Grand Total.
  'shipping': 0,                  // Shipping.
  'tax': 0                     // Tax.
});

ga('ecommerce:addItem', {
  'id': '{{booking_number}}',                     // Transaction ID.
  'name': 'Booking {{booked_rooms}} room(s) between {{arrival}} and {{departure}}',    // Product name.
  'sku': 'Booking {{booked_rooms}}',                 // SKU/code.
  'category': 'Rooms',         // Category or variation.
  'price': {{booking_price}},                 // Unit price.
  'quantity': 1                   // Quantity.
});

ga('ecommerce:send');
  
  });
</script>

<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-XXXXXX');</script>
<!-- End Google Tag Manager -->

Last page code in the body:

<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-XXXXXX"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->

Default code in header:

<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-XXXXXX');</script>
<!-- End Google Tag Manager -->

Default code in body:

<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-XXXXXX"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->

Yandex Metrica static example.

Use your own Metrica snippet or change the ID.

Default code in header:

<!-- Yandex.Metrika counter -->
<script type="text/javascript" >
   (function(m,e,t,r,i,k,a){m[i]=m[i]||function(){(m[i].a=m[i].a||[]).push(arguments)};
   m[i].l=1*new Date();k=e.createElement(t),a=e.getElementsByTagName(t)[0],k.async=1,k.src=r,a.parentNode.insertBefore(k,a)})
   (window, document, "script", "https://mc.yandex.ru/metrika/tag.js", "ym");

   ym(54115264, "init", {
        clickmap:true,
        trackLinks:true,
        accurateTrackBounce:true
   });
</script>
<noscript><div><img src="https://mc.yandex.ru/watch/XXXXXXX" style="position:absolute; left:-9999px;" alt="" /></div></noscript>
<!-- /Yandex.Metrika counter -->

How to create Yandex tag

Full list of the available dynamic tracking codes

{{page_name}}Name of the WRS page
{{today}}Today's date
{{arrival}}Arrival Date. Not present on the first page. Minimum arrival dates if multiple arrivals are booked.
{{departure}}Departure Date. Not present on the first page. Maximum departure dates if multiple departures are booked.
{{stay}}Stay. Not present on the first page.
{{first_name}}First name of the guest. Not present on the first page.
{{last_name}}Last name of the guest. Not present on the first page.
{{e_mail}}Email of the guest. Not present on the first page.
{{has_availability}}If the search finds available products, the parameter is 'true', else it is 'false'. Present only on the product (second) page.
{{lead_days}}Lead Days. The Difference between Today and Arrival date. Not present on the first page.
{{booking_price}}The total price of the selected rooms.
{{booking_price_currency}}The currency of the booking price.
{{booking_number}}List of booking numbers. Presented on the final page only.
{{booked_rooms}}How many rooms are booked. Presented on the final page only.

Important: The customer (hotel) is responsible for checking the PCI DSS Compliance of the developer of the javascript inserted into the WRS.

Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.

On this page