Skip to content

Commit 6fec75b

Browse files
authored
Remove internal tracking (#175)
* remove all internal tracking * remove logs * remove logs * update README
1 parent d84fbf4 commit 6fec75b

File tree

4 files changed

+51
-181
lines changed

4 files changed

+51
-181
lines changed

Mixpanel/Controller.cs

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -90,47 +90,10 @@ void OnApplicationPause(bool pauseStatus)
9090
private void Start()
9191
{
9292
MigrateFrom1To2();
93-
MixpanelTracking();
94-
CheckForMixpanelImplemented();
9593
Mixpanel.Log($"Mixpanel Component Started");
9694
StartCoroutine(WaitAndFlush());
9795
}
9896

99-
private void MixpanelTracking()
100-
{
101-
if (!MixpanelStorage.HasIntegratedLibrary) {
102-
StartCoroutine(SendHttpEvent("Integration", "85053bf24bba75239b16a601d9387e17", MixpanelSettings.Instance.Token, "", false));
103-
MixpanelStorage.HasIntegratedLibrary = true;
104-
}
105-
#if DEVELOPMENT_BUILD
106-
StartCoroutine(SendHttpEvent("SDK Debug Launch", "metrics-1", MixpanelSettings.Instance.Token, $",\"Debug Launch Count\":{MixpanelStorage.MPDebugInitCount}", true));
107-
#endif
108-
}
109-
110-
private void CheckForMixpanelImplemented()
111-
{
112-
if (MixpanelStorage.HasImplemented) {
113-
return;
114-
}
115-
116-
int implementedScore = 0;
117-
implementedScore += MixpanelStorage.HasTracked ? 1 : 0;
118-
implementedScore += MixpanelStorage.HasIdendified ? 1 : 0;
119-
implementedScore += MixpanelStorage.HasAliased ? 1 : 0;
120-
implementedScore += MixpanelStorage.HasUsedPeople ? 1 : 0;
121-
122-
if (implementedScore >= 3) {
123-
MixpanelStorage.HasImplemented = true;
124-
125-
StartCoroutine(SendHttpEvent("SDK Implemented", "metrics-1", MixpanelSettings.Instance.Token,
126-
$",\"Tracked\":{MixpanelStorage.HasTracked.ToString().ToLower()}" +
127-
$",\"Identified\":{MixpanelStorage.HasIdendified.ToString().ToLower()}" +
128-
$",\"Aliased\":{MixpanelStorage.HasAliased.ToString().ToLower()}" +
129-
$",\"Used People\":{MixpanelStorage.HasUsedPeople.ToString().ToLower()}",
130-
true
131-
));
132-
}
133-
}
13497

13598
private IEnumerator WaitAndFlush()
13699
{
@@ -268,12 +231,6 @@ private void MigrateFrom1To2() {
268231
bool optedOut = stateValue[optedOutKey];
269232
MixpanelStorage.IsTracking = !optedOut;
270233
}
271-
string trackedIntegrationKey = "tracked_integration";
272-
if (stateValue.ContainsKey(trackedIntegrationKey) && !stateValue[trackedIntegrationKey].IsNull)
273-
{
274-
bool trackedIntegration = stateValue[trackedIntegrationKey];
275-
MixpanelStorage.HasIntegratedLibrary = trackedIntegration;
276-
}
277234
}
278235
}
279236
catch (Exception)

Mixpanel/MixpanelAPI.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ public static void Alias(string alias)
6262
Value properties = new Value();
6363
properties["alias"] = alias;
6464
Track("$create_alias", properties);
65-
MixpanelStorage.HasAliased = true;
6665
Flush();
6766
}
6867

@@ -102,7 +101,6 @@ public static void Identify(string uniqueId)
102101
string oldDistinctId = MixpanelStorage.DistinctId;
103102
MixpanelStorage.DistinctId = uniqueId;
104103
Track("$identify", "$anon_distinct_id", oldDistinctId);
105-
MixpanelStorage.HasIdendified = true;
106104
}
107105

108106
[Obsolete("Please use 'DistinctId' instead!")]
@@ -200,7 +198,7 @@ public static void Clear()
200198
if (!IsInitialized()) return;
201199
Controller.DoClear();
202200
}
203-
201+
204202
/// <summary>
205203
/// Clears all super properties
206204
/// </summary>

Mixpanel/Storage.cs

Lines changed: 19 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -38,108 +38,12 @@ internal static bool HasMigratedFrom1To2
3838

3939
#endregion
4040

41-
#region HasIntegratedLibrary
42-
43-
private const string HasIntegratedLibraryName = "Mixpanel.HasIntegratedLibrary";
44-
45-
internal static bool HasIntegratedLibrary
46-
{
47-
get => Convert.ToBoolean(PreferencesSource.GetInt(HasIntegratedLibraryName, 0));
48-
set => PreferencesSource.SetInt(HasIntegratedLibraryName, Convert.ToInt32(value));
49-
}
50-
51-
#endregion
52-
53-
#region MPDebugInitCount
54-
55-
private const string MPDebugInitCountName = "Mixpanel.MPDebugInitCount";
56-
57-
internal static int MPDebugInitCount
58-
{
59-
get => PreferencesSource.GetInt(MPDebugInitCountName, 0);
60-
set => PreferencesSource.SetInt(MPDebugInitCountName, value);
61-
}
62-
63-
#endregion
64-
65-
#region HasImplemented
66-
67-
private const string HasImplementedName = "Mixpanel.HasImplemented";
68-
69-
internal static bool HasImplemented
70-
{
71-
get => Convert.ToBoolean(PreferencesSource.GetInt(HasImplementedName, 0));
72-
set => PreferencesSource.SetInt(HasImplementedName, Convert.ToInt32(value));
73-
}
74-
75-
#endregion
76-
77-
#region HasTracked
78-
79-
private const string HasTrackedName = "Mixpanel.HasTracked";
80-
81-
internal static bool HasTracked
82-
{
83-
get => Convert.ToBoolean(PreferencesSource.GetInt(HasTrackedName, 0));
84-
set => PreferencesSource.SetInt(HasTrackedName, Convert.ToInt32(value));
85-
}
86-
87-
#endregion
88-
89-
#region HasIdentified
90-
91-
private const string HasIdentifiedName = "Mixpanel.HasIdentified";
92-
93-
internal static bool HasIdendified
94-
{
95-
get => Convert.ToBoolean(PreferencesSource.GetInt(HasIdentifiedName, 0));
96-
set => PreferencesSource.SetInt(HasIdentifiedName, Convert.ToInt32(value));
97-
}
98-
99-
#endregion
100-
101-
#region HasAliased
102-
103-
private const string HasAliasedName = "Mixpanel.HasAliased";
104-
105-
internal static bool HasAliased
106-
{
107-
get => Convert.ToBoolean(PreferencesSource.GetInt(HasAliasedName, 0));
108-
set => PreferencesSource.SetInt(HasAliasedName, Convert.ToInt32(value));
109-
}
110-
111-
#endregion
112-
113-
#region HasUsedPeople
114-
115-
private const string HasUsedPeopleName = "Mixpanel.HasUsedPeople";
116-
117-
internal static bool HasUsedPeople
118-
{
119-
get => Convert.ToBoolean(PreferencesSource.GetInt(HasUsedPeopleName, 0));
120-
set => PreferencesSource.SetInt(HasUsedPeopleName, Convert.ToInt32(value));
121-
}
122-
123-
#endregion
124-
125-
#region HasTrackedFirstSDKDebugLaunch
126-
127-
private const string HasTrackedFirstSDKDebugLaunchName = "Mixpanel.HasTrackedFirstSDKDebugLaunch";
128-
129-
internal static bool HasTrackedFirstSDKDebugLaunch
130-
{
131-
get => Convert.ToBoolean(PreferencesSource.GetInt(HasTrackedFirstSDKDebugLaunchName, 0));
132-
set => PreferencesSource.SetInt(HasTrackedFirstSDKDebugLaunchName, Convert.ToInt32(value));
133-
}
134-
135-
#endregion
136-
13741
#region DistinctId
138-
42+
13943
private const string DistinctIdName = "Mixpanel.DistinctId";
140-
44+
14145
private static string _distinctId;
142-
46+
14347
public static string DistinctId
14448
{
14549
get
@@ -160,7 +64,7 @@ public static string DistinctId
16064
PreferencesSource.SetString(DistinctIdName, _distinctId);
16165
}
16266
}
163-
67+
16468
#endregion
16569

16670
#region Track
@@ -251,7 +155,7 @@ internal static Value DequeueBatchTrackingData(FlushType flushType, int batchSiz
251155
if (newStartIndex != oldStartIndex) {
252156
PreferencesSource.SetInt(startIndexKey, newStartIndex);
253157
}
254-
158+
255159
return batch;
256160
}
257161

@@ -264,7 +168,7 @@ internal static void DeleteBatchTrackingData(FlushType flushType, int batchSize)
264168
int dataIndex = oldStartIndex;
265169
int maxIndex = (flushType == FlushType.EVENTS) ? EventAutoIncrementingID() - 1 : PeopleAutoIncrementingID() - 1;
266170
while (deletedCount < batchSize && dataIndex <= maxIndex) {
267-
String trackingKey = (flushType == FlushType.EVENTS) ? "Event" + dataIndex.ToString() : "People" + dataIndex.ToString();
171+
String trackingKey = (flushType == FlushType.EVENTS) ? "Event" + dataIndex.ToString() : "People" + dataIndex.ToString();
268172
if (PreferencesSource.HasKey(trackingKey)) {
269173
PreferencesSource.DeleteKey(trackingKey);
270174
deletedCount++;
@@ -307,7 +211,7 @@ internal static void DeleteAllTrackingData(FlushType flushType)
307211
#region IsTracking
308212

309213
private const string IsTrackingName = "Mixpanel.IsTracking";
310-
214+
311215
private static bool _isTracking;
312216

313217
public static bool IsTracking
@@ -326,9 +230,9 @@ public static bool IsTracking
326230
}
327231

328232
#endregion
329-
233+
330234
#region OnceProperties
331-
235+
332236
private const string OncePropertiesName = "Mixpanel.OnceProperties";
333237

334238
private static Value _onceProperties;
@@ -359,11 +263,11 @@ internal static void ResetOnceProperties()
359263
properties.OnRecycle();
360264
OnceProperties = properties;
361265
}
362-
266+
363267
#endregion
364-
268+
365269
#region SuperProperties
366-
270+
367271
private const string SuperPropertiesName = "Mixpanel.SuperProperties";
368272

369273
private static Value _superProperties;
@@ -387,18 +291,18 @@ internal static Value SuperProperties
387291
PreferencesSource.SetString(SuperPropertiesName, JsonUtility.ToJson(_superProperties));
388292
}
389293
}
390-
294+
391295
internal static void ResetSuperProperties()
392296
{
393297
Value properties = SuperProperties;
394298
properties.OnRecycle();
395299
SuperProperties = properties;
396300
}
397-
301+
398302
#endregion
399-
303+
400304
#region TimedEvents
401-
305+
402306
private const string TimedEventsName = "Mixpanel.TimedEvents";
403307

404308
private static Value _timedEvents;
@@ -409,7 +313,7 @@ internal static Value TimedEvents
409313
{
410314
if (_timedEvents != null) return _timedEvents;
411315
if (!PreferencesSource.HasKey(TimedEventsName)) TimedEvents = new Value();
412-
else
316+
else
413317
{
414318
_timedEvents = new Value();
415319
JsonUtility.FromJsonOverwrite(PreferencesSource.GetString(TimedEventsName), _timedEvents);
@@ -422,14 +326,14 @@ internal static Value TimedEvents
422326
PreferencesSource.SetString(TimedEventsName, JsonUtility.ToJson(_timedEvents));
423327
}
424328
}
425-
329+
426330
internal static void ResetTimedEvents()
427331
{
428332
Value properties = TimedEvents;
429333
properties.OnRecycle();
430334
TimedEvents = properties;
431335
}
432-
336+
433337
#endregion
434338
}
435339
}

0 commit comments

Comments
 (0)