Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

140 integrate additional events into google analytics query into the prototype #255

Conversation

ebma
Copy link
Member

@ebma ebma commented Nov 5, 2024

It took me some time to figure out how to be able to properly watch the connected network. I noticed that the watchChainId and useChainId both don't fire when switching from or to a non-supported network, ie a network that is not defined in our wagmiConfig. Since only polygon is defined in our wagmiConfig, it never triggered when switching from any network to polygon.

Instead, we are now using the chainId contained in the data of the useAccount hook as it's always updated when the network changes.

GA config

New Variables

  • DLV | from_network and DLV | to_network
  • DLV | account_address

New triggers

  • DL Event | network_change

Events

  • New event GA4 Event | network_change
    • Has parameters from_network - > {{DLV | from_network }} and to_network -> {{DLV | to_network}}
    • Has trigger DL Event | network_change
  • Changed event GA4 Event | wallet_connect
    • Has new parameters account_address -> {{DLV | account_address}}

Closes #140.

@ebma ebma linked an issue Nov 5, 2024 that may be closed by this pull request
1 task
Copy link

netlify bot commented Nov 5, 2024

Deploy Preview for pendulum-pay ready!

Name Link
🔨 Latest commit 887d79a
🔍 Latest deploy log https://app.netlify.com/sites/pendulum-pay/deploys/672de23653e51000089e436d
😎 Deploy Preview https://deploy-preview-255--pendulum-pay.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@ebma ebma requested a review from a team November 5, 2024 17:24
Copy link
Member

@TorstenStueber TorstenStueber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks very good!

Copy link
Contributor

@Sharqiewicz Sharqiewicz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great changes! ✅ Just minor things

});

previousChainId.current = chainId;
}, [chainId, previousChainId]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing dependency: trackEvent

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

previousChainId is a useRef and it doesn't change across renders. We don't have to include it in the dependency array


trackEvent({
event: 'network_change',
from_network: previousChainId.current || chainId,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already check if previousChainId.current is undefined, we don't have to || chainId

@ebma
Copy link
Member Author

ebma commented Nov 8, 2024

Nice catch @Sharqiewicz, addressed all your comments ✔️

Copy link
Contributor

@gianfra-t gianfra-t left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested a few times normal cases and works okay 👍

@ebma ebma merged commit ac1767d into polygon-prototype-staging Nov 11, 2024
5 checks passed
@ebma ebma deleted the 140-integrate-additional-events-into-google-analytics-query-into-the-prototype branch November 11, 2024 18:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Integrate additional events into google analytics query into the prototype
4 participants