Send last tag scanned to template sensor

Hello, does anyone know a way to send te last tag scanned (the tag_id) into a template sensor?
I have been trying all sorts of ways, but i can’t seem to figure it out.

What i want to have is a template sensor that shows the last tag_id no matter what of the scanners was used to scan it.

i have tried this:

template:

  - trigger:
      - platform: event
        event_type: tag_scanned
        event_data:
          tag_id:
  - sensor:
      - name: "LaatsteTag"
        unique_id: edjfrejlkelmkerog
        state: >
          {{ trigger.event.data.tag_id }}

but that does’t seem to work. Each reader has a template sensor displaying the last read tag.
Any help would be apreciated!!

I my search for sollutions i found a post doing something similar by comparing the last_changed attribute:
so i ended up doing this like this and it works:

template:
  - sensor:
      - name: "LaatsteTag"
        state: >
          {%- set readers = [states.sensor.tagreader_prototype_last_tag, states.sensor.tagreader2_last_tag] %}
          {% for reader in readers %}
            {% if as_timestamp(reader.last_changed) == as_timestamp(readers | map(attribute='last_changed') | max) %}
              {{ reader.state }}
            {% endif %}
          {% endfor %}