---
# System prepended metadata

title: Labeling guide. Bug review

---

# Labeling guide. Bug review

**book.becasaapartments**

This document describes some necessary corrections for the correct measurement of the user's browsing path in the reservation process of https://book.becasaapartments.com/.
We currently have a number of events in the data layer that lack key information for measurement, so they will need to be modified. New events must have the standard Google Analytics 4 eCommerce structure: https://developers.google.com/tag-manager/ecommerce-ga4?hl=es

These modifications are detailed below:




## Search and use filters

### Reservation search

#### When    
Every time the user performs a reservation search.

![](https://i.imgur.com/sMQByn0.png)

#### Old event    
We currently do not have any event that measures this interaction.

#### New event    


```
dataLayer.push({
  event: "booking_search",
  userId: "ef79dcaa-1c2e-4543-9249-bec800e9cdd8"  
  location: "Rivas"                 // Search location
  start_date: "2023-04-01",         // Check in
  end_date: "2023-04-30",           // Departure date
  adults: 2,                        // Number of adults
  childrens: 0,                     // Number of children
  booking_type: “corta estancia”    // Category of the apartment. If it is more than two months, then "Larga estancia". If it is less than two months, then "Corta estancia".
  gtm.uniqueEventId: 16
})

```



### Use of filters

#### When    
Every time the filters are used. It should be activated every time the user interacts with any of the following elements:

![](https://i.imgur.com/7vuO5Ly.png)
<br>
![](https://i.imgur.com/263SGaV.png)    
    
#### Old events   

We currently have various events implemented in the various filter interactions.

##### Filter by location
```
dataLayer.push({event: "filter_by_location", ecommerce: {items: ["Rivas"]}, gtm.uniqueEventId: 76})
```
##### Filter by dates
```
dataLayer.push({event: "filter_by_dates", gtm.uniqueEventId: 136})
```
##### Filter by guests
```
dataLayer.push({event: "filter_by_guests", gtm.uniqueEventId: 158})
```
##### Filter by bedrooms
```
dataLayer.push({event: "filter_by_bedrooms", gtm.uniqueEventId: 176})
```
##### Filter by bathrooms
```
dataLayer.push({event: "filter_by_bathrooms", gtm.uniqueEventId: 194})

```

These interactions must be measured with a single event. Therefore the old events must be replaced by the new event.

#### New event    
```
<script>
window.dataLayer = window.dataLayer || [];
dataLayer.push({
  event: 'parameter_filter',
  userId: "ef79dcaa-1c2e-4543-9249-bec800e9cdd8"
  location: "Rivas"                     // Search location
  start_date: "2023-04-01",             // Check in
  end_date: "2023-04-30",               // Departure date
  adults: 2,                            // Number of adults
  childrens: 0,                         // Number of children
  bedrooms: 2                           // Number of bedrooms
  bathrooms: 2                          // Number of bathrooms
  24_hour_checkin: true                 // True if the checkbox is checked
  adapted_bath: true                    // True if the checkbox is checked
  spaces_non_smoking: true              // True if the checkbox is checked
  bar: true                             // True if the checkbox is checked
  24_hour_security: true                // True if the checkbox is checked
  aerobics: true                        // True if the checkbox is checked
  baggage_storage: true                 // True if the checkbox is checked
  accessible_parking: true              // True if the checkbox is checked 
  air_conditioning: true                // True if the checkbox is checked
  barbecue_utensils: true               // True if the checkbox is checked
  bath_or_shower: true                  // True if the checkbox is checked
  bathroom_amenities: true              // True if the checkbox is checked
  bathroom_emergency_pull_cord: true    // True if the checkbox is checked
  bbq_area: true                        // True if the checkbox is checked
  beach_chairs: true                    // True if the checkbox is checked
  bike_parking: true                    // True if the checkbox is checked
  business_center: true                 // True if the checkbox is checked  
});
</script>
```
Only the filters used will appear, so it will not be necessary to include in the dataLayer the filters whose box is not checked.


## Eventos de ecommerce

### view_item_list
#### When    

This event will need to be completed each time the user visits a listing page:

![](https://i.imgur.com/hvwMpXb.png)

#### Old event   

Currently the following event is activated as many times as apartments appeared in the list

```
dataLayer.push({
  event: "view_search_results",
  ecommerce: {
    items: [
      "/properties/607?mu=1",
      "Comfort 1 Bedroom Apartment with plus terrace",
      119.25,
      "EUR",
      null
    ]
  },
  gtm.uniqueEventId: 96
})
```

Therefore, these events must be unified and replaced by the new event

#### New event    


```
<script>
window.dataLayer = window.dataLayer || [];
dataLayer.push({
  'event': 'view_item_list',                     
  'item_list_id': 'item_list_id',        // The ID of the list in which the item was presented to the user.
  'item_list_name': 'item_list_name',    // The name of the list in which the item was presented to the user.
  'booking_type': 'Corta estancia',           // Category of the apartment. If it is more than two months, then "Larga estancia". If it is less than two months, then "Corta estancia".   
  'items': [
    {
      'item_id': '602',               // The ID of the item. *One of item_id or item_name is required.
      'item_name': 'Comfort 1 Bedroom Apartment',  // The name of the item. *One of item_id or item_name is required.
      'currency': 'EUR',             // The currency, in 3-letter ISO 4217 format.
      'item_list_id': 'item_list_id',     // The ID of the list in which the item was presented to the user.
      'price': 100                    // The monetary price of the item, in units of the specified currency parameter.     
    },
    {
      'item_id': '605',               // The ID of the item. *One of item_id or item_name is required.
      'item_name': 'Apartamento 1 dormitorio',    // The name of the item. *One of item_id or item_name is required.
      'currency': 'EUR',             // The currency, in 3-letter ISO 4217 format.
      'item_list_id': 'item_list_id',     // The ID of the list in which the item was presented to the user.
      'price': 200                    // The monetary price of the item per night or month, in units of the specified currency parameter.     
    }
  ]
});
</script>
```


This event must be unique and collect in the same dataLayer as many elements as apartments appeared in the list.


### view_item
#### When    

This event must be completed each time the user enters an apartment page.

#### Old event   

We currently do not have any events implemented that measure this interaction.

#### New event

This event must collect the details of apartment.

```
window.dataLayer = window.dataLayer || [];
dataLayer.push({
  event: "view_item",
  ecommerce: {
    items: [{
      item_id: '602',                     // The ID of the item. *One of item_id or item_name is required.
      item_name: 'Comfort 1 Bedroom Apartment',  // The name of the item. *One of item_id or item_name is required.
      price: '100                         // The monetary price of the item per night or month, in units of the specified currency parameter.   
      location: "Rivas"                   // Apartment location
      currency: 'EUR',                    // The currency, in 3-letter ISO 4217 format.    
      item_list_id: 'item_list_id',       // If associated with a list selection.
      item_list_name: 'item_list_name',   // If associated with a list selection.
      booking_type: 'Corta estancia'      // Category of the apartment. If it is more than two months, then "Larga estancia". If it is less than two months, then "Corta estancia".       
    }]
  }
});
```


### Begin checkout

#### When

This event must be completed each time the user initiates a purchase process.

![](https://i.imgur.com/Fghwvve.png)

#### Evento anterior    

Currently we have implemented the following event


```
dataLayer.push({
  event: "click_book_now",
  ecommerce: {
    items: [
      {
        id: "/properties/608?mu=1",
        name: "Comfort 1 Bedroom Apartment PMR",
        price: 1600,
        currency: "EUR"
      }
    ]
  },
  gtm.uniqueEventId: 84
})
```

This event does not collect all the necessary fields, so it must be replaced by the new event.

#### New event    

```
window.dataLayer = window.dataLayer || [];
dataLayer.push({
    event: "begin_checkout",
    ecommerce: {
      items: [{
        item_id: '602',               // The ID of the item. *One of item_id or item_name is required.
        item_name: 'Comfort 1 Bedroom Apartment',   // The name of the item. *One of item_id or item_name is required.
        price: 100                    // The monetary price of the item per night, in units of the specified currency parameter. 
        quantity: 20                  // Number of days of the reservation
        currency: 'eur',              // The currency, in 3-letter ISO 4217 format.
      }]
    }
});
```



### checkout step 2

#### When

This event must be completed in step 2 of checkout.

![](https://i.imgur.com/AXcVREZ.png)

#### Old event    

```
dataLayer.push({
  event: "checkout_step_2",
  ecommerce: {
    items: [
      {
        id: "/properties/608",
        name: "Comfort 1 Bedroom Apartment PMR",
        price: 1900,
        currency: "EUR"
      }
    ]
  },
  step: 2,
  gtm.uniqueEventId: 102
})
```

This event does not collect all the necessary fields so it must be replaced by the new event


#### New event    

```
window.dataLayer = window.dataLayer || [];
dataLayer.push({
    event: "checkout_step_2",
    ecommerce: {
      items: [{
        item_id: '602',               // The ID of the item. *One of item_id or item_name is required.
        item_name: 'Comfort 1 Bedroom Apartment',  // The name of the item. *One of item_id or item_name is required.
        price: 100                    // The monetary price of the item per night, in units of the specified currency parameter. 
        quantity: 20                  // Number of days of the reservation
        currency: 'EUR',              // The currency, in 3-letter ISO 4217 format.
      }]
    }
});
```
### checkout step 3

#### When

This event must be completed in step 3 of checkout.


![](https://i.imgur.com/5EG5mHR.png)

#### Old event


Currently we have implemented the following event

```
dataLayer.push({
  event: "checkout_step_3",
  ecommerce: {
    items: [
      {id: "/properties/602", name: "Comfort 1 Bedroom Apartment", price: 500, currency: "EUR"}
    ]
  },
  step: 3,
  gtm.uniqueEventId: 367
})
```

This event does not collect all the necessary data so it must be replaced by the new event.


#### New event 

```
window.dataLayer = window.dataLayer || [];
dataLayer.push({
    event: "checkout_step_3",
    email: "test@test.com" ,                // These data must be coded (SHA-256)
    phone_number: "+34640000000",           // These data must be coded (SHA-256)
        address: {
          first_name: "firs_name",          // These data must be coded (SHA-256)
          last_name: "last_name"            // These data must be coded (SHA-256)
},
    ecommerce: {
      items: [{
        item_id: '602',                   // The ID of the item. *One of item_id or item_name is required.
        item_name: 'Comfort 1 Bedroom Apartment',  // The name of the item. *One of item_id or item_name is required.
        price: 100                    // The monetary price of the item per night, in units of the specified currency parameter. 
        quantity: 20                  // Number of days of the reservation
        currency: 'EUR',             // The currency, in 3-letter ISO 4217 format.
      }]
    }
});
```
**It is important that the personal data of phone_number, email, fist_name and last_name are collected encrypted according to the Google documentation.** 

https://support.google.com/google-ads/answer/9004655 

### purchase
#### When
This event will need to be triggered at checkout. **It must be activated only once after completing the purchase**. If the user refreshes or enters this url again, the event should not fire again. 

![](https://i.imgur.com/aMjURrd.png)

#### Old event
We currently have the following event implemented in the purchase interaction:


```
dataLayer.push({event: "purchase", ecommerce: {items: ["rjM1-hfj1Rq6G6CeFfq8mA", 1600]}, gtm.uniqueEventId: 29})
```

This event should be replaced by the new event.

#### New event

```
dataLayer.push({ ecommerce: null });  // Clear the previous ecommerce object.
dataLayer.push({
  event: "purchase",
  ecommerce: {
      transaction_id: "T12345",           
      value: 2000,
      currency: "EUR",
      items: [{
        item_id: '602',                   // The ID of the item. *One of item_id or item_name is required.
        item_name: 'Comfort 1 Bedroom Apartment',   // The name of the item. *One of item_id or item_name is required.
        price: 100                        // The monetary price of the item per night, in units of the specified currency parameter. 
        quantity: 20                      // Number of days of the reservation
        currency: 'EUR',                  // The currency, in 3-letter ISO 4217 format.
      }]
  }
});
```    

