No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.esm.js 5.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. import firebase from '@firebase/app-compat';
  2. import { logEvent, setCurrentScreen, setUserId, setUserProperties, setAnalyticsCollectionEnabled, settings, isSupported } from '@firebase/analytics';
  3. import { Component } from '@firebase/component';
  4. var name = "@firebase/analytics-compat";
  5. var version = "0.2.1";
  6. /**
  7. * @license
  8. * Copyright 2020 Google LLC
  9. *
  10. * Licensed under the Apache License, Version 2.0 (the "License");
  11. * you may not use this file except in compliance with the License.
  12. * You may obtain a copy of the License at
  13. *
  14. * http://www.apache.org/licenses/LICENSE-2.0
  15. *
  16. * Unless required by applicable law or agreed to in writing, software
  17. * distributed under the License is distributed on an "AS IS" BASIS,
  18. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  19. * See the License for the specific language governing permissions and
  20. * limitations under the License.
  21. */
  22. var AnalyticsService = /** @class */ (function () {
  23. function AnalyticsService(app, _delegate) {
  24. this.app = app;
  25. this._delegate = _delegate;
  26. }
  27. AnalyticsService.prototype.logEvent = function (eventName, eventParams, options) {
  28. logEvent(this._delegate, eventName, eventParams, options);
  29. };
  30. /**
  31. * @deprecated Use {@link logEvent} with `eventName` as 'screen_view' and add relevant `eventParams`.
  32. * See {@link https://firebase.google.com/docs/analytics/screenviews | Track Screenviews}.
  33. */
  34. AnalyticsService.prototype.setCurrentScreen = function (screenName, options) {
  35. setCurrentScreen(this._delegate, screenName, options);
  36. };
  37. AnalyticsService.prototype.setUserId = function (id, options) {
  38. setUserId(this._delegate, id, options);
  39. };
  40. AnalyticsService.prototype.setUserProperties = function (properties, options) {
  41. setUserProperties(this._delegate, properties, options);
  42. };
  43. AnalyticsService.prototype.setAnalyticsCollectionEnabled = function (enabled) {
  44. setAnalyticsCollectionEnabled(this._delegate, enabled);
  45. };
  46. return AnalyticsService;
  47. }());
  48. /**
  49. * @license
  50. * Copyright 2021 Google LLC
  51. *
  52. * Licensed under the Apache License, Version 2.0 (the "License");
  53. * you may not use this file except in compliance with the License.
  54. * You may obtain a copy of the License at
  55. *
  56. * http://www.apache.org/licenses/LICENSE-2.0
  57. *
  58. * Unless required by applicable law or agreed to in writing, software
  59. * distributed under the License is distributed on an "AS IS" BASIS,
  60. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  61. * See the License for the specific language governing permissions and
  62. * limitations under the License.
  63. */
  64. /**
  65. * Officially recommended event names for gtag.js
  66. * Any other string is also allowed.
  67. */
  68. var EventName;
  69. (function (EventName) {
  70. EventName["ADD_SHIPPING_INFO"] = "add_shipping_info";
  71. EventName["ADD_PAYMENT_INFO"] = "add_payment_info";
  72. EventName["ADD_TO_CART"] = "add_to_cart";
  73. EventName["ADD_TO_WISHLIST"] = "add_to_wishlist";
  74. EventName["BEGIN_CHECKOUT"] = "begin_checkout";
  75. /**
  76. * @deprecated
  77. * This event name is deprecated and is unsupported in updated
  78. * Enhanced Ecommerce reports.
  79. */
  80. EventName["CHECKOUT_PROGRESS"] = "checkout_progress";
  81. EventName["EXCEPTION"] = "exception";
  82. EventName["GENERATE_LEAD"] = "generate_lead";
  83. EventName["LOGIN"] = "login";
  84. EventName["PAGE_VIEW"] = "page_view";
  85. EventName["PURCHASE"] = "purchase";
  86. EventName["REFUND"] = "refund";
  87. EventName["REMOVE_FROM_CART"] = "remove_from_cart";
  88. EventName["SCREEN_VIEW"] = "screen_view";
  89. EventName["SEARCH"] = "search";
  90. EventName["SELECT_CONTENT"] = "select_content";
  91. EventName["SELECT_ITEM"] = "select_item";
  92. EventName["SELECT_PROMOTION"] = "select_promotion";
  93. /** @deprecated */
  94. EventName["SET_CHECKOUT_OPTION"] = "set_checkout_option";
  95. EventName["SHARE"] = "share";
  96. EventName["SIGN_UP"] = "sign_up";
  97. EventName["TIMING_COMPLETE"] = "timing_complete";
  98. EventName["VIEW_CART"] = "view_cart";
  99. EventName["VIEW_ITEM"] = "view_item";
  100. EventName["VIEW_ITEM_LIST"] = "view_item_list";
  101. EventName["VIEW_PROMOTION"] = "view_promotion";
  102. EventName["VIEW_SEARCH_RESULTS"] = "view_search_results";
  103. })(EventName || (EventName = {}));
  104. /**
  105. * @license
  106. * Copyright 2021 Google LLC
  107. *
  108. * Licensed under the Apache License, Version 2.0 (the "License");
  109. * you may not use this file except in compliance with the License.
  110. * You may obtain a copy of the License at
  111. *
  112. * http://www.apache.org/licenses/LICENSE-2.0
  113. *
  114. * Unless required by applicable law or agreed to in writing, software
  115. * distributed under the License is distributed on an "AS IS" BASIS,
  116. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  117. * See the License for the specific language governing permissions and
  118. * limitations under the License.
  119. */
  120. var factory = function (container) {
  121. // Dependencies
  122. var app = container.getProvider('app-compat').getImmediate();
  123. var analyticsServiceExp = container.getProvider('analytics').getImmediate();
  124. return new AnalyticsService(app, analyticsServiceExp);
  125. };
  126. function registerAnalytics() {
  127. var namespaceExports = {
  128. Analytics: AnalyticsService,
  129. settings: settings,
  130. isSupported: isSupported,
  131. // We removed this enum in exp so need to re-create it here for compat.
  132. EventName: EventName
  133. };
  134. firebase.INTERNAL.registerComponent(new Component('analytics-compat', factory, "PUBLIC" /* ComponentType.PUBLIC */)
  135. .setServiceProps(namespaceExports)
  136. .setMultipleInstances(true));
  137. }
  138. registerAnalytics();
  139. firebase.registerVersion(name, version);
  140. export { registerAnalytics };
  141. //# sourceMappingURL=index.esm.js.map