Implements functionality that will send minting and unminting related events to Posthog.
Breakdown of the events sent to Posthog:
1. Wallet Connected
Initially this event was meant to be sent when the Connect Wallet button is clicked but we didn't have information about the address that is connected yet at this point. We didn't have the balance info too.
That's why this event is sent when the account from the useWeb3React hook changes. Besides that, we also check if the token balance was loaded based on the currently connected account (with the new value in token store - isLoadedFromConnectedAccount). This was needed, because initially the balance value is set to 0 so we can't recognize if the value is loaded for account or not based on just balance and loading value.
With the Wallet Connected event we send three properties, which are:
walletType - wallet type that user connected his wallet with, e.g. METAMASK, TAHO etc. It uses newly created function - getWalletTypeFromConnector - that will get the actual wallet type from the connector,
address - eth address that was connected,
tbtcBalance - current tbtc balance of the given account.
2. Wallet Disconnected
Simply just sends an event when the wallet is disconnected.
(Minting flow:)
3. (Autocapture event) Deposit Address Generated
This is a default autocapture event but with additional parameters so that it's easier to track it. The addtional parameters are:
button-name - it was used to identify those events before this PR. I'm leaving it just for compatibility with the previously catched events,
button-id - id of the button. Should be unique and not contain any spaces,
button-text - text that is displayed inside the button.
The autocapture tracks every click of the user by default, but additional parameters are added only when Generate Deposit Address button is clicked
4. (Autocapture event) Minting initiated
This is a default autocapture event but with additional parameters so that it's easier to track it. The addtional parameters are:
button-name - it was used to identify those events before this PR. I'm leaving it just for compatibility with the previously catched events,
button-id - id of the button. Should be unique and not contain any spaces,
button-text - text that is displayed inside the button,
deposited-btc-amount - btc amount (1e8 precision) that was sent to the currently generated deposit address.
(Unminting flow:)
5. (Autocapture event) Unminting initiated
This is a default autocapture event but with additional parameters so that it's easier to track it. The addtional parameters are:
button-name - this button was not tracked before, but we still add button-name just for consistency,
button-id - id of the button. Should be unique and not contain any spaces,
button-text - text that is displayed inside the button,
unminted-tbtc-amount - tbtc amount (1e18 precision) that user plan to unmint
Note: Bear in mind that this event is only for Unmint button in InitiateMinting modal. It does not track the Unmint button in Unmint page.
Ref: #731 #732
Implements functionality that will send minting and unminting related events to Posthog.
Breakdown of the events sent to Posthog:
1. Wallet Connected
Initially this event was meant to be sent when the
Connect Wallet
button is clicked but we didn't have information about the address that is connected yet at this point. We didn't have the balance info too.That's why this event is sent when the
account
from theuseWeb3React
hook changes. Besides that, we also check if the token balance was loaded based on the currently connected account (with the new value in token store -isLoadedFromConnectedAccount
). This was needed, because initially thebalance
value is set to 0 so we can't recognize if the value is loaded for account or not based on justbalance
andloading
value.With the
Wallet Connected
event we send three properties, which are:walletType
- wallet type that user connected his wallet with, e.g. METAMASK, TAHO etc. It uses newly created function -getWalletTypeFromConnector
- that will get the actual wallet type from the connector,address
- eth address that was connected,tbtcBalance
- current tbtc balance of the given account.2. Wallet Disconnected
Simply just sends an event when the wallet is disconnected.
3. (Autocapture event) Deposit Address Generated
This is a default autocapture event but with additional parameters so that it's easier to track it. The addtional parameters are:
button-name
- it was used to identify those events before this PR. I'm leaving it just for compatibility with the previously catched events,button-id
- id of the button. Should be unique and not contain any spaces,button-text
- text that is displayed inside the button.The autocapture tracks every click of the user by default, but additional parameters are added only when Generate Deposit Address button is clicked
4. (Autocapture event) Minting initiated
This is a default autocapture event but with additional parameters so that it's easier to track it. The addtional parameters are:
button-name
- it was used to identify those events before this PR. I'm leaving it just for compatibility with the previously catched events,button-id
- id of the button. Should be unique and not contain any spaces,button-text
- text that is displayed inside the button,deposited-btc-amount
- btc amount (1e8 precision) that was sent to the currently generated deposit address.5. (Autocapture event) Unminting initiated
This is a default autocapture event but with additional parameters so that it's easier to track it. The addtional parameters are:
button-name
- this button was not tracked before, but we still addbutton-name
just for consistency,button-id
- id of the button. Should be unique and not contain any spaces,button-text
- text that is displayed inside the button,unminted-tbtc-amount
- tbtc amount (1e18 precision) that user plan to unmintNote: Bear in mind that this event is only for Unmint button in
InitiateMinting
modal. It does not track theUnmint
button inUnmint
page.