ため (or 為（ため） in its kanji form) is a noun in Japanese that can be translated quite closely to ‘sake’ in English. However, it is classified as a 非自立（ひじりつ） (non-independent) word in Japanese, and must always be connected to another word which illustrates the ‘sake’ that ため is highlighting. The 格助詞（かくじょし） (case marking particle) に will often be added after ため, to show that (A) is a goal that something will done to reach.
However, when used with verbs in the past tense, ために
more frequently highlights that something happened ‘due to (A)’, rather than ‘for the sake of (A)’. Because of this, a more accurate description of ため in all situations is ‘in light of (A)’. This expresses that (A) is the primary or major event/thing that resulted in (B).
To use ために
as ‘in light of’, ‘as a result of’, or ‘because of’, attach it to the end of verb in its past form, or a noun follow by の. It may also be used after い-Adjectives
in their 連体形（れんたいけい） (attributive form).
Because I drank a lot of alcohol at the party last night, I am tired today with a hangover.
Due to it being hot, a few people have passed out at work.
Due to this app being useful, the number of users are steadily growing.
Due to heavy rain, we will be canceling the soccer tournament.
This ‘in light of (A)’ nuance can be used in reference to things that have already happened (as above), or in reference to something that is considered as the purpose of an action (as in our other ために
In order to win the karate tournament, I practice every day until late at night.
Due to me practicing until late at night last night, I don't want to do anything today.