I found the below Listening script great for adding metadata to my InDesign PDFs. I wanted the Author and Document Title included in the PDF Document Properties each time I generated a PDF as a default.
As a bonus I found this script also applies the same metadata (under File > File Info...) to every InDesign file I create by default. *You need to export as PDF first before the data appears in File Info...
You can customize as you like then copy into InDesign Startup Scripts folder and restart InDesign.
The original script was found in this thread: https://forums.adobe.com/thread/1856961 I added the "author" data.
Hope this helps.
tell application "Adobe InDesign CC 2019"
make event listener with properties {event type:"beforeExport", handler:addMeta}
end tell
on addMeta()
tell application "Adobe InDesign CC 2019"
tell active document
-- the ID doc name
set n to name
-- the page count
set p to count of pages
--a list of visible layers
set l to name of every layer whose visible is true
set llist to ""
repeat with x in l
set llist to x & ", " & llist
end repeat
set llist to "Visible Layers: " & llist
--the page count and layer list for the description field
set ptext to "Document Page Count: " & p & " " & llist as string
set properties of metadata preferences to {author:"YOUR NAME", document title:n, description:ptext}
end tell
end tell
end addMeta