<p>it seems parse feed event only provide url and response. i don't know about specifying additional data for feed but some other solutions are:</p>
<ul>
<li>add feed name as query string to feed url (if it is url and you have have control over it) and parse url on EVENT_AFTER_PARSE_FEED to detect feed name</li>
</ul>
<pre><code>Event::on(DataTypes::class, DataTypes::EVENT_AFTER_PARSE_FEED, function (FeedDataEvent $event) {
   $url = parse_url($event-&gt;url);
   $path = $url['path'];
   $query = $url['query'];
 });
</code></pre>
<ul>
<li>using <a href="https://docs.craftcms.com/feed-me/v4/developers/events.html#the-beforeprocessfeed-event" rel="nofollow noreferrer"><code>EVENT_BEFORE_PROCESS_FEED</code></a> and changing feed data before processing</li>
</ul>
<pre><code>&lt;?php
use craft\feedme\events\FeedProcessEvent;
use craft\feedme\services\Process;
use yii\base\Event;
Event::on(Process::class, Process::EVENT_BEFORE_PROCESS_FEED, function(FeedProcessEvent $event) {
    if ($event-&gt;name == 'feed A') {
      foreach ($event-&gt;feedData as $key =&gt; $data) {
        $event-&gt;feedData[$key]['title'] = 'item' . $key; //changing data attribute of each data
      }
    }
});
?&gt;
</code></pre>

CC BY-SA 4.0
2021-03-30T06:50:53.673Z
2021-03-30T07:01:29.620Z
2021-03-30T07:01:29.620Z
user9975
<p>I'm working with Feed Me to run several feeds, bringing in multiple Entry types. I need to do some additional preparation work via an <code>EVENT_AFTER_PARSE_FEED</code> handler, which works well when I only have a single feed, but fails when I add a second feed.</p>
<p>I want to run the event handler for Feed A, but not for Feed B: Is there a simple way of specifying the feed when registering the event handler, or querying the event name inside the event handler?</p>

<plugin-feedme>
Registering events for a specific feed in Feed Me
# Registering events for a specific feed in Feed Me

(Asked by: username_0 on 2021-03-30)

I'm working with Feed Me to run several feeds, bringing in multiple Entry types. I need to do some additional preparation work via an `EVENT_AFTER_PARSE_FEED` handler, which works well when I only have a single feed, but fails when I add a second feed.

I want to run the event handler for Feed A, but not for Feed B: Is there a simple way of specifying the feed when registering the event handler, or querying the event name inside the event handler?

**Tags:** plugin-feedme

---

## 1 answers

### Answer by username_1 on 2021-03-30. Score: 3 | Accepted answer

it seems parse feed event only provide url and response. i don't know about specifying additional data for feed but some other solutions are:

add feed name as query string to feed url (if it is url and you have have control over it) and parse url on EVENT_AFTER_PARSE_FEED to detect feed name

Event::on(DataTypes::class, DataTypes::EVENT_AFTER_PARSE_FEED, function (FeedDataEvent $event) {
   $url = parse_url($event->url);
   $path = $url['path'];
   $query = $url['query'];
 });


using EVENT_BEFORE_PROCESS_FEED and changing feed data before processing

name == 'feed A') {
      foreach ($event->feedData as $key => $data) {
        $event->feedData[$key]['title'] = 'item' . $key; //changing data attribute of each data
      }
    }
});
?>


---

