# Adding extra 'opts' data to the "DiscourseEvent.on(:post\_created)" event from javascript?

**URL:** <https://meta.discourse.org/t/adding-extra-opts-data-to-the-discourseevent-on-post-created-event-from-javascript/84889>\
**Category:** Development\
**Created:** [April 9, 2018, 4:05pm UTC](https://meta.discourse.org/t/adding-extra-opts-data-to-the-discourseevent-on-post-created-event-from-javascript/84889 "2018-04-09T16:05:46Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![Vespura](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vespura/32/206564_2.png) [@Vespura](https://meta.discourse.org/u/Vespura)\
**Post date:** [April 9, 2018, 4:05pm UTC](https://meta.discourse.org/t/adding-extra-opts-data-to-the-discourseevent-on-post-created-event-from-javascript/84889/1 "2018-04-09T16:05:46Z")

</div>

I’ve been looking through the github repository and on the forums as well, but I’ve not been able to find what I’m looking for yet. Apologies if this has already been answered before.

I’m trying to add some extra data (just 1 custom value is all i need) to a post right before/when it’s created. I need to do this from a javascript asset, and I need to be able to access it in the `plugin.rb` file using:

```ruby
DiscourseEvent.on(:post_created) do |post, opts, user|

```

If this isn’t possible or not easy to do from a javascript asset then being able to append text just before post creation to the `:raw` post would also work for what I need.

I’m only just starting to create my first plugins so I’m still trying to figure out how to use events/existing functions.

Thanks in advance if anyone could point me in the right direction.

---

_[View the full topic](https://meta.discourse.org/t/adding-extra-opts-data-to-the-discourseevent-on-post-created-event-from-javascript/84889)._
