|
@@ -121,10 +121,8 @@ class AnalyticsAdapter {
|
121
|
121
|
}
|
122
|
122
|
|
123
|
123
|
this.analyticsHandlers = new Set(handlers);
|
124
|
|
- this.analyticsHandlers.forEach(
|
125
|
|
- handler => {
|
126
|
|
- handler.setUserProperties(this.permanentProperties);
|
127
|
|
- });
|
|
124
|
+
|
|
125
|
+ this._setUserProperties();
|
128
|
126
|
|
129
|
127
|
// Note that we disable the cache even if the set of handlers is empty.
|
130
|
128
|
const cache = this.cache;
|
|
@@ -135,6 +133,22 @@ class AnalyticsAdapter {
|
135
|
133
|
}
|
136
|
134
|
}
|
137
|
135
|
|
|
136
|
+ /**
|
|
137
|
+ * Set the user properties to the analytics handlers.
|
|
138
|
+ *
|
|
139
|
+ * @returns {void}
|
|
140
|
+ */
|
|
141
|
+ _setUserProperties() {
|
|
142
|
+ this.analyticsHandlers.forEach(handler => {
|
|
143
|
+ try {
|
|
144
|
+ handler.setUserProperties(this.permanentProperties);
|
|
145
|
+ } catch (error) {
|
|
146
|
+ logger.warn('Error in setUserProperties method of one of the '
|
|
147
|
+ + `analytics handlers: ${error}`);
|
|
148
|
+ }
|
|
149
|
+ });
|
|
150
|
+ }
|
|
151
|
+
|
138
|
152
|
/**
|
139
|
153
|
* Adds a set of permanent properties to this this AnalyticsAdapter.
|
140
|
154
|
* Permanent properties will be added as "attributes" to events sent to
|
|
@@ -151,9 +165,7 @@ class AnalyticsAdapter {
|
151
|
165
|
...properties
|
152
|
166
|
};
|
153
|
167
|
|
154
|
|
- this.analyticsHandlers.forEach(handler => {
|
155
|
|
- handler.setUserProperties(this.permanentProperties);
|
156
|
|
- });
|
|
168
|
+ this._setUserProperties();
|
157
|
169
|
}
|
158
|
170
|
|
159
|
171
|
/**
|