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

feat(analytics): add & deprecate pre-defined analytics events #3385

Merged
merged 34 commits into from
Jul 9, 2020

Conversation

russellwheatley
Copy link
Member

@russellwheatley russellwheatley commented Apr 1, 2020

fixes #3512

New API

New event methods added.

  • logAddShippingInfo
  • logPostScore
  • logPurchase
  • logRefund
  • logSelectItem
  • logSelectPromotion
  • logViewCart
  • logViewPromotion

Removed API

API that now fires a console.warn() when called.

  • logEcommercePurchase
  • logPresentOffer
  • logPurchaseRefund

Unchanged or slight modifications

Following API may have changed in minor ways

  1. Where all properties are optional, I've made the event argument a default empty object so that users can make event function calls without passing any argument.
  2. A number of API have currency & value properties which require the compound property check to ensure both are present if one is present.
  • logAddToWishlist
  • logAppOpen
  • logBeginCheckout
  • logCampaignDetails
  • logEarnVirtualCurrency
  • logGenerateLead
  • logJoinGroup
  • logLevelStart
  • logLevelUp
  • logLogin
  • logSelectContent
  • logRemoveFromCart
  • logSearch
  • logAddPaymentInfo
  • logAddToCart
  • logSetCheckoutOption
  • logShare
  • logSignUp
  • logSpendVirtualCurrency
  • logTutorialBegin
  • logUnlockAchievement
  • logViewItem
  • logViewItemList
  • logViewSearchResults

Notes

  • Moved all analytic's JS tests to analytics.test.ts.

@russellwheatley russellwheatley changed the title updating analytics types update pre-defined analytics event types Apr 1, 2020
@codecov
Copy link

codecov bot commented Apr 2, 2020

Codecov Report

Merging #3385 into master will decrease coverage by 6.38%.
The diff coverage is 79.17%.

@@            Coverage Diff             @@
##           master    #3385      +/-   ##
==========================================
- Coverage   62.89%   56.52%   -6.37%     
==========================================
  Files         113      108       -5     
  Lines        3705     3433     -272     
  Branches      192        0     -192     
==========================================
- Hits         2330     1940     -390     
- Misses       1328     1493     +165     
+ Partials       47        0      -47     

@russellwheatley russellwheatley changed the title update pre-defined analytics event types feat(analytics): add & deprecate pre-defined analytics event types May 6, 2020
@russellwheatley russellwheatley changed the title feat(analytics): add & deprecate pre-defined analytics event types feat(analytics): add & deprecate pre-defined analytics events May 6, 2020
@russellwheatley russellwheatley marked this pull request as ready for review May 6, 2020 15:18
@russellwheatley russellwheatley requested review from Salakar and Ehesp May 27, 2020 07:36
/**
* Purchase currency in 3 letter [ISO_4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format. E.g. `USD`.
*/
//TODO if value is a param, so must currency: https://firebase.google.com/docs/reference/android/com/google/firebase/analytics/FirebaseAnalytics.Event#public-static-final-string-add_to_wishlist
Copy link
Member

Choose a reason for hiding this comment

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

TODO here

Copy link
Member Author

@russellwheatley russellwheatley Jun 24, 2020

Choose a reason for hiding this comment

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

I'm not actually sure about this. If currency is a property on the object then value must also be present.

I think we will have to update the event types to have something like this: https://stackoverflow.com/a/51507473 what do you think?

Copy link
Member

@Salakar Salakar left a comment

Choose a reason for hiding this comment

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

Some additional points:

Ta

packages/analytics/lib/index.js Outdated Show resolved Hide resolved
packages/analytics/lib/index.js Outdated Show resolved Hide resolved
packages/analytics/lib/index.js Outdated Show resolved Hide resolved
packages/analytics/lib/structs.js Show resolved Hide resolved
@russellwheatley
Copy link
Member Author

I've had to temporarily stop the ml-vision tests to stop it from failing.

@russellwheatley russellwheatley requested a review from Salakar June 26, 2020 10:38
@Salakar Salakar requested review from Ehesp and removed request for Ehesp June 30, 2020 20:21
Salakar
Salakar previously approved these changes Jul 6, 2020
@dackers86 dackers86 self-requested a review July 7, 2020 09:36
@russellwheatley russellwheatley merged commit 6c53f47 into master Jul 9, 2020
andersondanilo pushed a commit to vixtech/react-native-firebase that referenced this pull request Nov 9, 2020
…ase#3385)

* updating analytics types

* further type updates

* update log events for analytics

* update validation

* feat(analytics): update events & tests

* tests(analytics): update

* build(analytics): types & type tests

* chore(analytics): update to revised api

* feat(analytics): further updates for package

* Apply suggestions from code review

Co-authored-by: Mike Diarmid <[email protected]>

* tests(analytics): update tests

* tests(ml-vision): stop testing ml-vision

* chore(*): spelling

* chore(*): spelling

* chore(analytics): update ts docs

Co-authored-by: Mike Diarmid <[email protected]>
[publish]
andersondanilo pushed a commit to vixtech/react-native-firebase that referenced this pull request Nov 9, 2020
…ase#3385)

* updating analytics types

* further type updates

* update log events for analytics

* update validation

* feat(analytics): update events & tests

* tests(analytics): update

* build(analytics): types & type tests

* chore(analytics): update to revised api

* feat(analytics): further updates for package

* Apply suggestions from code review

Co-authored-by: Mike Diarmid <[email protected]>

* tests(analytics): update tests

* tests(ml-vision): stop testing ml-vision

* chore(*): spelling

* chore(*): spelling

* chore(analytics): update ts docs

Co-authored-by: Mike Diarmid <[email protected]>
[publish]
@mikehardy mikehardy deleted the @russell/analytics-types branch December 17, 2020 21:00
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.

[analytics] ECOMMERCE_PURCHASE is now deprecated
2 participants