How to save the number of times a node was achieved?

how to save the number of times a node was achieved?

I want to save how many errors occurred during a loop and send to slack at the end of the workflow

ex: error += 1

Right off the top of my head I would say you have to keep the state somewhere to accumulate the number of errors and when the loop ends grab it and send it Slack. You can use the workflow’s static data using a function node or something like Google Sheets, Airtable, Baserow, etc.