My Hotel Shop - Set Up Tracking Code

Created by Katrín Magnúsdóttir, Modified on Mon, 29 Jul at 3:12 PM by Martin Gjorgjievski

In order to start using My Hotel Shop you need to set the correct tracking code in your Booking Engine (IBE).

 

You need to go into Settings -> Connectivity Settings -> Booking Engine Settings. There you need to select the appropriate Booking Engine Profile and click the pencil (edit) icon. (click on image to enlarge).
Most hotels are using the default booking engine on their website. 

 

Once you have your the edit form open you need to navigate down to Google Analytics code and copy the following code in the field.

 

If you require all of MHS pixels and Google hotel ads pixels please copy the following code in the field:

 

<!-- Begin MHS, GHA and GA tracking code -->
<script type="text/javascript" src="https://mhs1.ams3.cdn.digitaloceanspaces.com/mhs-client-tracking-v1.min.js"></script>
<script async src="https://www.googletagmanager.com/gtag/js?id=GID"></script>
<script>
mhsClientTracking.trackUser(true);
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('set', 'linker', {'domains': ['DOMAIN', 'app.thebookingfactory.com'], 'decorate_forms': true, 'accept_incoming': true});
gtag('js', new Date());
gtag('config', 'GID');

function confirmation_tag(booking_object) {
if (booking_object['booked_rooms'] && booking_object['booked_rooms'].length > 0) {
var number_of_nights = ((new Date(booking_object.date_departure) - new Date(booking_object.date_arrival)) / 86400000);
var mhsCV = {
'revenue': booking_object.amount,
'roomnights': number_of_nights,
'rooms': booking_object.room_count,
'reservationnumber': booking_object.token,
'currency': booking_object.currency,
'adults': booking_object.adults,
'checkinDate': booking_object.date_arrival,
'hid': FILL_HID,
'api_key': 'FILL_API_KEY',
'user_id': 'FILL_USER_ID'
};

mhsClientTracking.trackConversion(booking_object.agree_marketing_tos, mhsCV);
gtag('event', 'purchase', {
'send_to': [
'GID/SEND_TO'
],
'transaction_id': booking_object.token,
'value': booking_object.amount,
'currency': booking_object.currency,
'items': [{
'id': 'FILL_PURCHASE_ID',
'start_date': booking_object.date_arrival,
'end_date': booking_object.date_departure
}]
});

gtag('event', 'conversion', {
'send_to': 'FILL_GADS ID',
'value': booking_object.amount,
'currency': booking_object.currency,
'transaction_id': booking_object.token
});
}
}
</script>
<!-- Begin MHS, GHA and GA tracking code -->

 

If you only require Google Hotel Ads and Google Ads pixels, please copy these values in:

 

<!-- Begin GHA and GA tracking code -->
<script async src="https://www.googletagmanager.com/gtag/js?id=GID"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('set', 'linker', {'domains': ['DOMAIN', 'app.thebookingfactory.com'], 'decorate_forms': true, 'accept_incoming': true});
gtag('js', new Date());
gtag('config', 'GID');

function confirmation_tag(booking_object) {
if (booking_object['booked_rooms'] && booking_object['booked_rooms'].length > 0) {
gtag('event', 'purchase', {
'send_to': [
'GID/SEND_TO'
],
'transaction_id': booking_object.token,
'value': booking_object.amount,
'currency': booking_object.currency,
'items': [{
'id': 'FILL_PURCHASE_ID',
'start_date': booking_object.date_arrival,
'end_date': booking_object.date_departure
}]
});

gtag('event', 'conversion', {
'send_to': 'FILL_GADS_ID',
'value': booking_object.amount,
'currency': booking_object.currency,
'transaction_id': booking_object.token
});
}
}
</script>
<!-- End GHA and GA tracking code -->

 

If you only need the My Hotel Shop pixels please copy the following values:

 

<!-- Begin MHS tracking code -->
<script type="text/javascript" src="https://mhs1.ams3.cdn.digitaloceanspaces.com/mhs-client-tracking-v1.min.js"></script>
<script>
mhsClientTracking.trackUser(true);

function confirmation_tag(booking_object) {
if (booking_object['booked_rooms'] && booking_object['booked_rooms'].length > 0) {
var number_of_nights = ((new Date(booking_object.date_departure) - new Date(booking_object.date_arrival)) / 86400000);
var mhsCV = {
'revenue': booking_object.amount,
'roomnights': number_of_nights,
'rooms': booking_object.room_count,
'reservationnumber': booking_object.token,
'currency': booking_object.currency,
'adults': booking_object.adults,
'checkinDate': booking_object.date_arrival,
'hid': FILL_HID,
'api_key': 'FILL_API_KEY',
'user_id': 'FILL_USER_ID'
};

mhsClientTracking.trackConversion(booking_object.agree_marketing_tos, mhsCV);
}
}
</script>
<!-- End MHS tracking code -->

 

You need to replace the FILL_HID, FILL_API_KEY, GID, SEND_TO, DOMAIN, FILL_GADS, FILL_PURCHASE_ID, and FILL_USER_ID in the code with the appropriate values you receive from My Hotel Shop.

 

Once that is finished you just need to click save on the Booking Profile edit form and you're all set!

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article