# Lead events filter not work

**URL:** <https://forum.mautic.org/t/lead-events-filter-not-work/7189>\
**Category:** Product Support\
**Created:** [January 16, 2017, 4:58pm UTC](https://forum.mautic.org/t/lead-events-filter-not-work/7189 "2017-01-16T16:58:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![lvocella](https://avatars.discourse-cdn.com/v4/letter/l/839c29/32.png) [@lvocella](https://forum.mautic.org/u/lvocella)\
**Post date:** [January 16, 2017, 4:58pm UTC](https://forum.mautic.org/t/lead-events-filter-not-work/7189/1 "2017-01-16T16:58:16Z")

</div>

![2017_01_16_17h56_53.png](https://s29.postimg.org/3oduhn5pz/2017_01_16_17h56_53.png)

  
Typing something in the search box won't filter events correctly.

---

<div class="post-metadata">

**Author:** ![lvocella](https://avatars.discourse-cdn.com/v4/letter/l/839c29/32.png) [@lvocella](https://forum.mautic.org/u/lvocella)\
**Post date:** [January 16, 2017, 4:58pm UTC](https://forum.mautic.org/t/lead-events-filter-not-work/7189/2 "2017-01-16T16:58:16Z")

</div>

![](https://s29.postimg.org/3oduhn5pz/2017_01_16_17h56_53.png)

Typing something in the search box won’t filter events correctly.

---

<div class="post-metadata">

**Author:** ![lvocella](https://avatars.discourse-cdn.com/v4/letter/l/839c29/32.png) [@lvocella](https://forum.mautic.org/u/lvocella)\
**Post date:** [January 17, 2017, 11:49am UTC](https://forum.mautic.org/t/lead-events-filter-not-work/7189/3 "2017-01-17T11:49:27Z")

</div>

I added these few lines…

[code]  
case ‘page.hit’:  
if(!empty($filters))  
{  
$this-\>addSearchTextIdentifiedEntry($event, $type, $name);  
}

```
				break;[/code]

```

[code]/\*\*  
\* @param EventsLeadTimelineEvent $event  
\* @param $eventTypeKey  
\* @param $eventTypeName  
\*/  
protected function addSearchTextIdentifiedEntry(EventsLeadTimelineEvent $event, $eventTypeKey, $eventTypeName)  
{  
$lead = $event-\>getLead();  
$hits = $this-\>em-\>getRepository(‘MauticPageBundle:Hit’)-\>getHitsByLead($lead-\>getId(), $event-\>getQueryOptions());

```
    // Add to counter
    $event->addToCounter($eventTypeKey, $hits);

    if (!$event->isEngagementCount()) {
        // Add the logs to the event array
        foreach ($hits['results'] as $hit) {
            $icon = 'fa-link';
            
            $event->addEvent(
                    [
                        'event' => $eventTypeKey,
                        'eventType' => $eventTypeName,
                        'eventLabel' => $hit['url_title'],
                        'timestamp' => $hit['date_hit'],
                        'icon' => $icon,
                        'extra' => [
                            'hits' => $hit,
                        ],
                        'contentTemplate' => 'MauticLeadBundle:SubscribedEventsTimeline:pagehitadded.html.php',
                    ]
                );
        }
    } else {
        // Purposively not including this in engagements graph as the engagement is counted by the page hit
    }
}[/code]

```

please tell me if it is a good approach or not. I’ll tear my hair when an upgrade will take place…
