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

[Feature] Anonymous User Tracking #764

Open
wants to merge 252 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 215 commits
Commits
Show all changes
252 commits
Select commit Hold shift + click to select a range
3734f8b
add merge user doc
hani329 Dec 19, 2023
fdf24e9
merge user error resolve
hani329 Dec 22, 2023
0ebe2d1
resolve build error
hani-iterable Dec 27, 2023
594b83c
Add missing file after PR merge
hani-iterable Dec 27, 2023
98910ee
Resolve build fail errors and clean up code
hani-iterable Jan 1, 2024
4db5a94
modify test cases for anonymous user merge
hani-iterable Jan 9, 2024
608e818
merge all other AUT branch code
hani-iterable Jan 18, 2024
d86a75b
set config for AUT
hani-iterable Jan 25, 2024
8ef9b22
implement endpoint for anon session
hani-iterable Feb 16, 2024
2fc2332
Append user data along with track session data with userid as UUID
hardikmashru Mar 26, 2024
56b37d2
updates
hardikmashru Mar 27, 2024
718af73
updates
hardikmashru Mar 28, 2024
5aebd72
Update CommonExtensions.swift
hardikmashru Mar 28, 2024
8892e1d
Merge branch 'feature/itbl_track_anon_user' into aut_demo
evantk91 May 26, 2024
67a231b
Merge pull request #732 from Iterable/aut_demo
evantk91 May 26, 2024
f440cd0
Merge branch 'feature/itbl_track_anon_user' into MOB-8047
evantk91 May 27, 2024
81be9ee
Merge pull request #755 from Iterable/MOB-8047
evantk91 May 27, 2024
528256c
SDK changes to merge user and criteria match
hardikmashru Jun 12, 2024
cf5ff8e
Removed withUser
hardikmashru Jun 14, 2024
9511378
some improvements
hardikmashru Jun 15, 2024
c55f882
fixed some tests
hardikmashru Jun 15, 2024
b8d4872
Merge branch 'master' into feature/itbl_track_anon_user
hardikmashru Jun 16, 2024
42693fa
conflict resolution after merging master to AUT
hardikmashru Jun 16, 2024
7f27cec
merge tests disabled
hardikmashru Jun 16, 2024
74b7e29
bug fixes with double values having trailing zeros
hardikmashru Jun 24, 2024
66298d4
Merge pull request #776 from Iterable/fixpricewith_trailingzeros
evantk91 Jun 24, 2024
1c594ab
Minmatch and single item matches done with test cases
hardikmashru Jun 26, 2024
4f66fe5
Is set match and test cases
hardikmashru Jun 27, 2024
1ad4f77
Fixed user event
hardikmashru Jun 27, 2024
caabfb4
[SDK] iOS - remove sync events call when SDK is initialized
hardikmashru Jun 27, 2024
2817f9c
check for SDK initialization needs to be separated and missing return…
hardikmashru Jun 27, 2024
125a2c5
Fixed comment
hardikmashru Jun 27, 2024
330fa0b
Fixed comment
hardikmashru Jun 27, 2024
acf3080
Fixed comment
hardikmashru Jun 27, 2024
a000a3d
[iOS-SDK] Not combinator logic
hardikmashru Jun 28, 2024
df58b61
Not test case done
hardikmashru Jun 28, 2024
214f60b
Merge branch 'itbl_min_match_items' into itbl_is_set_match
hardikmashru Jun 28, 2024
a7d9af6
Temp changes in is set
hardikmashru Jun 28, 2024
40294ae
Merge branch 'feature/itbl_track_anon_user' into itbl_min_match_items
hardikmashru Jun 28, 2024
db53f54
Added logs
hardikmashru Jul 1, 2024
0dac88e
Remove items key
hardikmashru Jul 1, 2024
8988852
fixed warnings
hardikmashru Jul 1, 2024
55dc491
some bug fixes
hardikmashru Jul 1, 2024
c17180c
fixed warnings
hardikmashru Jul 1, 2024
9e367cc
Merge pull request #781 from Iterable/MOB-8961
evantk91 Jul 1, 2024
3a3f888
Merge pull request #778 from Iterable/itbl_min_match_items
evantk91 Jul 1, 2024
578e6ad
Merge branch 'feature/itbl_track_anon_user' into MOB-8820
evantk91 Jul 1, 2024
224a0a1
Merge pull request #779 from Iterable/MOB-8820
evantk91 Jul 2, 2024
2ee4546
Added merge param
hardikmashru Jul 2, 2024
628771d
Merge all cases
hardikmashru Jul 2, 2024
dd8947a
Remove log
hardikmashru Jul 2, 2024
44fc499
Revert temp logic
hardikmashru Jul 2, 2024
3253d49
Fixed comment
hardikmashru Jul 3, 2024
7cd1ea0
Fixed comment
hardikmashru Jul 3, 2024
5b8d122
Merge pull request #780 from Iterable/MOB-8822
evantk91 Jul 3, 2024
b605438
Test file fixed
hardikmashru Jul 4, 2024
8abe640
All test cases are done
hardikmashru Jul 4, 2024
c211c89
Updatecart is set fixed
hardikmashru Jul 5, 2024
2c3a193
Update cart is set done
hardikmashru Jul 5, 2024
a6fe094
Merge branch 'feature/itbl_track_anon_user' into itbl_is_set_match
hardikmashru Jul 5, 2024
5ee11ea
Merge branch 'temp_isset' into itbl_is_set_match
hardikmashru Jul 5, 2024
87ef408
Fixed error
hardikmashru Jul 5, 2024
8756734
Remover static json
hardikmashru Jul 5, 2024
34bd746
Fixed test case issue
hardikmashru Jul 5, 2024
5417103
Revert update cart old changes
hardikmashru Jul 5, 2024
d6d37f4
Merge branch 'feature/itbl_track_anon_user' into itbl_merge_param
evantk91 Jul 8, 2024
4ff68e3
Merge pull request #787 from Iterable/itbl_merge_param
evantk91 Jul 8, 2024
a5ad68d
finished isSet criterias for updateCart and purchase events
hardikmashru Jul 9, 2024
11fc89f
Merge branch 'feature/itbl_track_anon_user' into itbl_is_set_match
hardikmashru Jul 9, 2024
72a9a3d
Merge branch 'master' into feature/itbl_track_anon_user
evantk91 Jul 9, 2024
85b0af4
Merge branch 'feature/itbl_track_anon_user' into itbl_is_set_match
evantk91 Jul 9, 2024
fcde6d7
Merge branch 'master' into feature/itbl_track_anon_user
Jul 9, 2024
b422fa7
Merge branch 'feature/itbl_track_anon_user' of github.com:Iterable/sw…
Jul 9, 2024
195d723
Merge branch 'feature/itbl_track_anon_user' into itbl_is_set_match
Jul 9, 2024
642fec7
addresses warning
Jul 9, 2024
f88c1fe
minor cleanup
Jul 9, 2024
02da1a2
Merge pull request #789 from Iterable/itbl_is_set_match
evantk91 Jul 9, 2024
ef7408f
updates merge flow to align with Android
Jul 10, 2024
087d496
resolves tests
Jul 10, 2024
9c0aa66
updates merge flow
Jul 10, 2024
0ad5070
resolves unit tests and sets merge to false for setting anonymous user
Jul 10, 2024
ba28308
Update swift-sdk/Internal/InternalIterableAPI.swift
evantk91 Jul 11, 2024
527933c
addresses comments
Jul 11, 2024
7f0d464
adds check for anonymous user id stored
Jul 13, 2024
cd861bf
reverts check
Jul 15, 2024
2ade395
Merge pull request #790 from Iterable/evan/MOB-8962-set-anonymous-user
evantk91 Jul 15, 2024
91c0876
adds anonymous user id stored check
Jul 18, 2024
cfc07df
fixes unit tests
Jul 18, 2024
b7c3f6c
adds event storage clearing if merge does not occur
Jul 18, 2024
0d28531
minor edits
Jul 18, 2024
9bfba2d
Merge pull request #791 from Iterable/evan/MOB-9109-add-anonymous-id-…
evantk91 Jul 18, 2024
7237b39
MOB-9138: Resolves DoesNotEqual criteria match issue
megha-iterable Aug 8, 2024
4559a1e
MOB-9314: Written automated unit test cases for different field types…
megha-iterable Aug 9, 2024
fed98c1
Resolve nested criteria match issue
hani-iterable Aug 9, 2024
3c8e124
Merge branch 'bugfix/MOB-9138-resolves-DoesNotEqual-criteria-match' i…
megha-iterable Aug 13, 2024
1f705f3
Merge pull request #803 from Iterable/bugfix/MOB-9314-automated-unit-…
megha-iterable Aug 13, 2024
25360cd
Merge pull request #801 from Iterable/bugfix/MOB-9138-resolves-DoesNo…
evantk91 Aug 13, 2024
0d745ac
Merge branch 'feature/itbl_track_anon_user' into bugfix_MOB_9149
evantk91 Aug 13, 2024
5eb3064
MOB-9310: Write automated unit tests against Combination logic with E…
megha-iterable Aug 14, 2024
f8489b9
MOB-9304 Replayed events don't have proper createdAt timestamp
megha-iterable Aug 17, 2024
b4366e3
MOB 8826 - limit the number of stored events and make the number of s…
megha-iterable Aug 20, 2024
b6a5cd0
refactoring
Aug 20, 2024
0762033
Merge branch 'feature/MOB-8826-Event-storage-configuration-for-AUT' i…
megha-iterable Aug 21, 2024
7c366d1
refactors setEmail and setUserId
Aug 22, 2024
cc60635
Merge branch 'feature/itbl_track_anon_user' into evan/MOB-9349-disabl…
evantk91 Aug 22, 2024
f39263d
MOB-9313: Fully supports comparison for data in Array data with all c…
megha-iterable Aug 23, 2024
006e24b
updates tryMergeUser
Aug 23, 2024
2d0a397
removes getSourceUserIdOrEmail function
Aug 23, 2024
3290f88
minor update
Aug 23, 2024
512a1ee
Merge pull request #807 from Iterable/feature/MOB-8826-Event-storage-…
evantk91 Aug 26, 2024
274e8c3
Merge branch 'feature/itbl_track_anon_user' into bugfix_MOB_9149
evantk91 Aug 26, 2024
c2c56fc
updates unit test
Aug 26, 2024
b9b10a6
Merge branch 'feature/itbl_track_anon_user' into bugfix/MOB-9310-auto…
evantk91 Aug 26, 2024
72c8993
Merge pull request #804 from Iterable/bugfix/MOB-9310-automated-unit-…
evantk91 Aug 26, 2024
300a2b1
Merge branch 'feature/itbl_track_anon_user' into feature/MOB-9313-Ful…
megha-iterable Aug 27, 2024
4e26650
Correcting some mark comments for some of the test cases
megha-iterable Aug 27, 2024
f7b8014
Merge branch 'feature/itbl_track_anon_user' into bugfix_MOB_9149
evantk91 Aug 27, 2024
e88f2b3
Merge pull request #802 from Iterable/bugfix_MOB_9149
evantk91 Aug 27, 2024
0640011
Merge branch 'feature/itbl_track_anon_user' into feature/MOB-9304-Rep…
evantk91 Aug 27, 2024
a1bf845
MOB-9309 Support nested field types
megha-iterable Aug 28, 2024
efeecf4
aligns with android
Aug 28, 2024
e86f117
Merge branch 'feature/itbl_track_anon_user' into evan/MOB-9349-disabl…
evantk91 Aug 28, 2024
b2b1a3d
Merge branch 'feature/itbl_track_anon_user' into evan/MOB-9421-make-t…
evantk91 Aug 28, 2024
1f73395
Merge pull request #810 from Iterable/evan/MOB-9349-disabling-merging…
evantk91 Aug 28, 2024
f4c3489
Merge branch 'feature/itbl_track_anon_user' into evan/MOB-9421-make-t…
Aug 28, 2024
6de2943
Merge branch 'feature/itbl_track_anon_user' into evan/MOB-9421-make-t…
evantk91 Aug 28, 2024
e4efbf3
Merge branch 'evan/MOB-9421-make-tryMergeUser-private' of github.com:…
Aug 28, 2024
bd2e082
reference localStorage in AnonymousUserMerge
Aug 28, 2024
49a20fb
Merge branch 'feature/itbl_track_anon_user' into feature/MOB-9304-Rep…
evantk91 Aug 29, 2024
836d6e7
Merge pull request #806 from Iterable/feature/MOB-9304-Replayed-event…
evantk91 Aug 29, 2024
a8ab8b0
Merge branch 'feature/itbl_track_anon_user' into feature/MOB-9309-Sup…
evantk91 Aug 29, 2024
920b25d
Merge branch 'feature/itbl_track_anon_user' into evan/MOB-9421-make-t…
evantk91 Aug 29, 2024
122f825
Merge branch 'feature/itbl_track_anon_user' into feature/MOB-9313-Ful…
evantk91 Aug 29, 2024
c44e26c
Merge pull request #811 from Iterable/feature/MOB-9313-Fully-support-…
evantk91 Aug 29, 2024
bde4fdd
Merge branch 'feature/itbl_track_anon_user' into evan/MOB-9421-make-t…
evantk91 Aug 29, 2024
ad609e4
Merge pull request #814 from Iterable/evan/MOB-9421-make-tryMergeUser…
evantk91 Aug 30, 2024
ae4e780
Update the nested logic as per the #PR_815 comment
megha-iterable Sep 2, 2024
9aeeb1d
Merge branch 'feature/itbl_track_anon_user' into feature/MOB-9309-Sup…
megha-iterable Sep 2, 2024
248dd0a
Merge pull request #815 from Iterable/feature/MOB-9309-Support-nested…
evantk91 Sep 2, 2024
9807ed2
Add Support isOneOf and isNotOneOf comparator
megha-iterable Sep 3, 2024
daaa10d
Merge pull request #818 from Iterable/feature/MOB-9387-Support-isOneO…
evantk91 Sep 4, 2024
ddcbf5b
Merge branch 'master' into feature/itbl_track_anon_user
megha-iterable Sep 10, 2024
ec20722
MOB-9449: update user should not be a separate call
megha-iterable Sep 10, 2024
ac2163b
comments for readibility
Sep 11, 2024
c3b0561
Merge pull request #820 from Iterable/feature/MOB-9449-update-user-sh…
evantk91 Sep 11, 2024
7074315
isNotOneOf criteria is causing a crash
megha-iterable Sep 15, 2024
4cd20be
Merge pull request #824 from Iterable/bugfix/MOB-9518-isNotOneOf-crit…
evantk91 Sep 15, 2024
b95df32
changes criterias to criteriaSets
Sep 18, 2024
897166e
resolves unit tests
Sep 18, 2024
c129779
Merge pull request #828 from Iterable/evan/MOB-9584
evantk91 Sep 19, 2024
2ac4e1f
adds IterableIdentityResolution
Sep 19, 2024
2bc840d
Merge branch 'feature/itbl_track_anon_user' into evan/MOB-9560-identi…
evantk91 Sep 19, 2024
d6f8f2f
updates function call in AnonymousUserManager
Sep 19, 2024
01b37ca
updates unit tests
Sep 19, 2024
20a6808
updates setting anonymous user to call internal IterableAPI
Sep 19, 2024
4483db4
- Add test to validate object created by custom event API calls
megha-iterable Sep 19, 2024
90d4bad
Merge branch 'feature/itbl_track_anon_user' into bugfix/MOB-9306-Add-…
megha-iterable Sep 20, 2024
1cf3c07
- Add support to check for nested criteria a.b.c
megha-iterable Sep 20, 2024
50efd83
- events are not getting replayed (unknown user to known user)
megha-iterable Sep 20, 2024
900011b
Merge pull request #832 from Iterable/bugfix/MOB-9517-events-are-not-…
evantk91 Sep 20, 2024
526169a
updates spelling
Sep 20, 2024
473980d
Merge branch 'feature/itbl_track_anon_user' into evan/MOB-9560-identi…
evantk91 Sep 20, 2024
dc777ee
corrects improperly assigned variables
Sep 20, 2024
b91d58e
Merge branch 'feature/itbl_track_anon_user' into bugfix/MOB-9306-Add-…
megha-iterable Sep 20, 2024
b82b8e6
Merge pull request #831 from Iterable/bugfix/MOB-9306-Add-test-to-val…
evantk91 Sep 20, 2024
9df309c
removes commented out functions
Sep 23, 2024
3d6bc72
Merge branch 'feature/itbl_track_anon_user' into evan/MOB-9560-identi…
evantk91 Sep 24, 2024
eb28d3e
Merge pull request #830 from Iterable/evan/MOB-9560-identity-resolution
evantk91 Sep 24, 2024
0a91e58
Add handlers for notifying customer app of a newly created Anon userid
megha-iterable Sep 30, 2024
35c8b2a
Write automated unit tests against Complex criteria
megha-iterable Sep 30, 2024
b6a9073
Merge pull request #834 from Iterable/feature/MOB-9637-Add-handlers-f…
evantk91 Sep 30, 2024
4e36187
Merge branch 'feature/itbl_track_anon_user' into feature/MOB-9310-Wri…
evantk91 Sep 30, 2024
315d312
Add support for Nested JSON with Array Criteria Match
megha-iterable Oct 4, 2024
445c893
Merge branch 'master' into feature/itbl_track_anon_user
evantk91 Oct 7, 2024
ac62b9e
Merge branch 'feature/itbl_track_anon_user' into bugfix/MOB-9672-Nest…
evantk91 Oct 7, 2024
0c7981a
Merge pull request #837 from Iterable/bugfix/MOB-9672-Nested-JSON-wit…
evantk91 Oct 7, 2024
c7f6f43
Merge branch 'feature/itbl_track_anon_user' into feature/MOB-9310-Wri…
evantk91 Oct 8, 2024
ceabece
updates complex criteria 3 tests
Oct 8, 2024
dad1d7e
Merge pull request #835 from Iterable/feature/MOB-9310-Write-automate…
evantk91 Oct 8, 2024
22f4d60
adds unit test case
Oct 8, 2024
6759822
Keep AUT off until consent to track has been granted
megha-iterable Oct 9, 2024
9edb215
enable anonymousUsageTrack permission to test User merge scenarios tests
megha-iterable Oct 9, 2024
fa61f91
Merge pull request #838 from Iterable/evan/additional-complex-criteri…
evantk91 Oct 9, 2024
6077610
Merge branch 'feature/itbl_track_anon_user' into feature/MOB-9677-Kee…
evantk91 Oct 10, 2024
7b89260
Merge pull request #839 from Iterable/feature/MOB-9677-Keep-AUT-off-u…
evantk91 Oct 10, 2024
2b9c9e6
adds consent log statement
Oct 11, 2024
18c1c94
Merge pull request #841 from Iterable/evan/log-consent
evantk91 Oct 11, 2024
8e7371f
adds additional logging
Oct 11, 2024
4124e4d
minor edits
Oct 11, 2024
42d3b6f
Merge pull request #842 from Iterable/evan/additional-testing-logging
evantk91 Oct 11, 2024
956048c
adds check for anon tracking enablement and updates logging
Oct 14, 2024
0561323
Merge pull request #843 from Iterable/evan/MOB-9751
evantk91 Oct 14, 2024
e0612cc
updates replay to call syncEvents directly
Oct 15, 2024
b54a9c9
Update swift-sdk/Internal/InternalIterableAPI.swift
evantk91 Oct 16, 2024
f6741cb
Update swift-sdk/Internal/InternalIterableAPI.swift
evantk91 Oct 16, 2024
23e70ff
updates unit tests
Oct 16, 2024
7b2c9c9
updates unit tests
Oct 16, 2024
9ef537f
updates unit tests
Oct 17, 2024
e55535f
🎨 Formatted code and removed unnecessary let statements
joaodordio Oct 17, 2024
cd981cb
Merge pull request #846 from Iterable/evan/MOB-9646
evantk91 Oct 17, 2024
28f1524
Merge pull request #845 from Iterable/evan/MOB-9974
evantk91 Oct 17, 2024
8fe79bd
adding user update storage first steps
Oct 22, 2024
e976e8e
🔧 Updated UserDefaults implementation for anonumous user update
joaodordio Oct 22, 2024
fb972c8
🔧 Fixed wrong key usage
joaodordio Oct 22, 2024
f5ad559
🔧 Separated user update logic from regular user events saved in local…
joaodordio Oct 22, 2024
3395df1
🔀 Fixed code flow control
joaodordio Oct 22, 2024
c1aed93
✅ Fixed unit tests
joaodordio Oct 22, 2024
1a4cc8a
✅ Fixed lint issue
joaodordio Oct 22, 2024
761154b
updates user update saving logic
Oct 22, 2024
73e7a92
Merge pull request #848 from Iterable/evan/MOB-9996
evantk91 Oct 22, 2024
1d44bbb
Added support for fetching new JWT prior to calling merge
megha-iterable Oct 23, 2024
f3a0799
resolve property 'config' in closure requires explicit use of 'self' …
megha-iterable Oct 23, 2024
bcbe8da
cleanup
Oct 23, 2024
72cd8e4
🔧 Added sdk initialization checks to all API calls that warrant it. C…
joaodordio Oct 24, 2024
093e1e8
updates method naming
Oct 24, 2024
f7fafc8
renaming
Oct 24, 2024
b137b86
Merge pull request #851 from Iterable/evan/MOB-10055
evantk91 Oct 24, 2024
57860d0
Merge branch 'feature/itbl_track_anon_user' into joao/MOB-9946-ios-ad…
evantk91 Oct 24, 2024
ffa7efd
update public method gating
Oct 24, 2024
3083362
Merge branch 'joao/MOB-9946-ios-add-auth-checks-for-api-call-methods'…
evantk91 Oct 24, 2024
02e1f42
Merge branch 'feature/itbl_track_anon_user' into feature/MOB-9746-Use…
evantk91 Oct 24, 2024
3f449ae
Merge pull request #852 from Iterable/evan/MOB-9946
evantk91 Oct 25, 2024
9a26368
Merge pull request #850 from Iterable/joao/MOB-9946-ios-add-auth-chec…
evantk91 Oct 28, 2024
49eb8f3
Merge branch 'feature/itbl_track_anon_user' into feature/MOB-9746-Use…
evantk91 Oct 30, 2024
9ed3cdd
Merge pull request #849 from Iterable/feature/MOB-9746-Use-destinatio…
evantk91 Oct 30, 2024
1a5ec6d
renaming
Oct 30, 2024
ebfa82a
Merge branch 'master' into evan/MOB-10089
evantk91 Oct 30, 2024
d4cb261
Merge branch 'master' into feature/itbl_track_anon_user
evantk91 Oct 30, 2024
23b6394
Merge branch 'feature/itbl_track_anon_user' into evan/MOB-10089
evantk91 Oct 30, 2024
1d56e8a
Merge pull request #856 from Iterable/evan/MOB-10089
evantk91 Oct 30, 2024
49940e2
renames to enableAnonActivation
Oct 31, 2024
e23c17c
Merge branch 'feature/itbl_track_anon_user' into evan/MOB-10093-final…
evantk91 Oct 31, 2024
9e05993
remaning
Oct 31, 2024
e7d04d2
Merge pull request #857 from Iterable/evan/MOB-10093-final-cleanup
evantk91 Oct 31, 2024
7464bca
removes anon user markdown files
Nov 5, 2024
d6a5071
Merge pull request #858 from Iterable/evan/MOB-10120
evantk91 Nov 5, 2024
a7b3624
adds clearVisitorEventsAndUserData method
Nov 6, 2024
b51513a
Merge branch 'feature/itbl_track_anon_user' into evan/MOB-10126
evantk91 Nov 6, 2024
a2579be
Merge pull request #859 from Iterable/evan/MOB-10126
evantk91 Nov 6, 2024
abb0460
updates pointers and changelog
Nov 7, 2024
196d443
clears local storage when replay is false
Nov 7, 2024
2955f6f
fixes unit tests
Nov 7, 2024
709a05e
Merge pull request #862 from Iterable/evan/MOB-10136
evantk91 Nov 7, 2024
b5f6d4a
Merge branch 'feature/itbl_track_anon_user' into evan/MOB-10114-6.6.0…
evantk91 Nov 7, 2024
6db86f8
adds release notes to changelog
Nov 8, 2024
038176a
update pointers
Nov 11, 2024
3ae0d6a
reverts unit test
Nov 11, 2024
2413ab2
minor edit
Nov 11, 2024
1cbd51a
Merge pull request #861 from Iterable/evan/MOB-10114-6.6.0-beta
evantk91 Nov 11, 2024
0256e0b
Merge branch 'master' into feature/itbl_track_anon_user
evantk91 Nov 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
113 changes: 113 additions & 0 deletions AnonymousUserEventTracking.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
# AnonymousUserManager Class

## Class Introduction

The `AnonymousUserManager` class is responsible for managing anonymous user sessions and tracking events.
The `AnonymousUserManager+Functions` class is contains util functions and `CriteriaCompletionChecker` struct which contains criteria checking logic.
It includes methods for updating sessions, tracking events (i.e custom event, update cart, update user and purchase) and create a user if criterias are met.
We call track methods of this class internally to make sure we have tracked the events even when user is NOT logged in and after certain criterias are met we create a user and logs them automatically and sync events through Iterable API.

## Class Structure

The `AnonymousUserManager` class includes the following key components:

- **Methods:**
- `updateAnonSession()`: Updates the anonymous user session.
- `trackAnonEvent(name: String, dataFields: [AnyHashable: Any]?)`: Tracks an anonymous event and store it locally.
- `trackAnonPurchaseEvent(total: NSNumber, items: [CommerceItem], dataFields: [AnyHashable: Any]?)`: Tracks an anonymous purchase event and store it locally.
- `trackAnonUpdateUser(_ dataFields: [AnyHashable: Any])`: Tracks an anonymous update user event and store it locally.
- `trackAnonUpdateCart(items: [CommerceItem])`: Tracks an anonymous cart event and store it locally.
- `trackAnonTokenRegistration(token: String)`: Tracks an anonymous token registration event and store it locally.
- `getAnonCriteria()`: Gets the anonymous criteria.
- `checkCriteriaCompletion()`: Checks if criterias are being met.
- `createKnownUser()`: Creates a user after criterias met and login the user and then sync the data through track APIs.
- `syncEvents()`: Syncs locally saved data through track APIs.
- `updateAnonSession()`: Stores an anonymous sessions locally. Update the last session time when new session is created.
- `storeEventData()`: Stores event data locally.
- `logout()`: Reset the locally saved data when user logs out to make sure no old data is left.
- `syncNonSyncedEvents()`: Syncs unsynced data which might have failed to sync when calling syncEvents for the first time after criterias met.
- `convertCommerceItems(from dictionaries: [[AnyHashable: Any]]) -> [CommerceItem]`: Convert to commerce items from dictionaries.
- `convertCommerceItemsToDictionary(_ items: [CommerceItem]) -> [[AnyHashable:Any]]`: Convert commerce items to dictionaries.
- `getUTCDateTime()`: Converts UTC Datetime from current time.


## Methods Description

### `updateAnonSession()`

This method updates the anonymous user session. It does the following:

* Retrieves the previous session data from local storage.
* Increments the session number.
* Stores the updated session data back to local storage.

### `trackAnonEvent(name: String, dataFields: [AnyHashable: Any]?)`

This method tracks an anonymous event. It does the following:

* Creates a dictionary object with event details, including the event name, timestamp, data fields, and tracking type.
* Stores the event data in local storage.
* Checks criteria completion and creates a known user if criteria are met.

### `trackAnonPurchaseEvent(total: NSNumber, items: [CommerceItem], dataFields: [AnyHashable: Any]?)`

This method tracks an anonymous purchase event. It does the following:

* Converts the list of commerce items to JSON.
* Creates a dictionary object with purchase event details, including items, total, timestamp, data fields, and tracking type.
* Stores the purchase event data in local storage.
* Checks criteria completion and creates a known user if criteria are met.

### `trackAnonUpdateUser(dataFields: [AnyHashable: Any]?)`

This method tracks an anonymous update user event. It does the following:

* Creates a dictionary object with event details, including the event name, timestamp, data fields, and tracking type.
* Stores the event data in local storage, and if data of this event already exists it replaces the data.
* Checks criteria completion and creates a known user if criteria are met.

### `trackAnonUpdateCart(items: [CommerceItem])`

This method tracks an anonymous cart update. It does the following:

* Converts the list of commerce items to dictionary.
* Creates a dictionary object with cart update details, including items, timestamp, and tracking type.
* Stores the cart update data in local storage.
* Checks criteria completion and creates a known user if criteria are met.

### `trackAnonTokenRegistration(token: String)`

This method tracks an anonymous token registration event and stores it locally.

### `getAnonCriteria()`

This method is responsible for fetching criteria data. It simulates calling an API and saving data in local storage.

### `checkCriteriaCompletion()`

This private method checks if criteria for creating a known user are met. It compares stored event data with predefined criteria and returns `criteriaId` if any of the criteria is matched.

### `createKnownUser()`

This method is responsible for creating a known user in the Iterable API. It does the following:

* Sets a random user ID using a UUID (Universally Unique Identifier).
* Retrieves user session data from local storage.
* If user session data exists, it updates the user information in the Iterable API.
* Calls the syncEvents() method to synchronize anonymous tracked events.
* Finally, it clears locally stored data after data is syncronized.

### `syncEvents()`

This method is used to synchronize anonymous tracked events stored in local storage with the Iterable API. It performs the following tasks:

* Retrieves the list of tracked events from local storage.
* Iterates through the list of events and processes each event based on its type.
* Supported event types include regular event tracking, purchase event tracking, and cart update tracking.
* For each event, it extracts relevant data, including event name, data fields, items (for purchase and cart update events), and timestamps.
* It then calls the Iterable API to sync these events.
* After processing all the events, it clears locally stored event data.

### `updateAnonSession()`

This method is responsible for storing/updating anonymous sessions locally. It updates the last session time each time when new session is created.
38 changes: 38 additions & 0 deletions AnonymousUserMerge.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# AnonymousUserMerge Class

## Class Introduction

The `AnonymousUserMerge` class is responsible for merging anonymous user with logged-in one.
It includes methods for merge user by userId and emailId.
We call methods of this class internally to merge user when setUserId or setEmail method call. After merge we sync events through Iterable API.

## Class Structure

The `AnonymousUserMerge` class includes the following key components:

- **Methods:**
- `mergeUserUsingUserId(apiClient: IterableApiClient, destinationUserId: String)`: Merge user using userID if anonymous user exists and sync events
- `mergeUserUsingEmail(apiClient: IterableApiClient, destinationEmail: String)`: Merge user using emailId if anonymous user exists and sync events
- `callMergeApi(apiClient: IterableApiClient, sourceEmail: String, sourceUserId: String, destinationEmail: String, destinationUserId: String)`: Call API to merge user and sync remaining events.

## Methods Description

### `mergeUserUsingUserId(apiClient: IterableApiClient, destinationUserId: String)`

This method merge the anonymous user with the logged-in one. It does the following:

* Check for user exists using userId.
* If user exists then call the merge user API.

### `mergeUserUsingEmail(apiClient: IterableApiClient, destinationEmail: String)`

This method merge the anonymous user with the logged-in one. It does the following:

* Check for user exists using emailId.
* If user exists then call the merge user API.

### `callMergeApi(apiClient: IterableApiClient, sourceEmail: String, sourceUserId: String, destinationEmail: String, destinationUserId: String)`

This method call API to merge user. It does the following:

* Call the Iterable API and sync remaining events.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
objects = {

/* Begin PBXBuildFile section */
37088F332B3C38250000B218 /* IterableAppExtensions in Frameworks */ = {isa = PBXBuildFile; productRef = 37088F322B3C38250000B218 /* IterableAppExtensions */; };
37088F352B3C38250000B218 /* IterableSDK in Frameworks */ = {isa = PBXBuildFile; productRef = 37088F342B3C38250000B218 /* IterableSDK */; };
551A5FF1251AB1950004C9A0 /* IterableSDK in Frameworks */ = {isa = PBXBuildFile; productRef = 551A5FF0251AB1950004C9A0 /* IterableSDK */; };
551A5FF3251AB19B0004C9A0 /* IterableAppExtensions in Frameworks */ = {isa = PBXBuildFile; productRef = 551A5FF2251AB19B0004C9A0 /* IterableAppExtensions */; };
AC1BDF5820E304BC000010CA /* CoffeeListTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = AC5ECD9E20E304000081E1DA /* CoffeeListTableViewController.swift */; };
Expand Down Expand Up @@ -79,13 +81,15 @@
buildActionMask = 2147483647;
files = (
551A5FF1251AB1950004C9A0 /* IterableSDK in Frameworks */,
37088F352B3C38250000B218 /* IterableSDK in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
ACA3A14B20E2F83D00FEF74F /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
37088F332B3C38250000B218 /* IterableAppExtensions in Frameworks */,
551A5FF3251AB19B0004C9A0 /* IterableAppExtensions in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -219,6 +223,7 @@
name = "swift-sample-app";
packageProductDependencies = (
551A5FF0251AB1950004C9A0 /* IterableSDK */,
37088F342B3C38250000B218 /* IterableSDK */,
);
productName = "swift-sample-app";
productReference = ACA3A13520E2F6AF00FEF74F /* swift-sample-app.app */;
Expand All @@ -239,6 +244,7 @@
name = "swift-sample-app-notification-extension";
packageProductDependencies = (
551A5FF2251AB19B0004C9A0 /* IterableAppExtensions */,
37088F322B3C38250000B218 /* IterableAppExtensions */,
);
productName = "swift-sample-app-notification-extension";
productReference = ACA3A14E20E2F83D00FEF74F /* swift-sample-app-notification-extension.appex */;
Expand Down Expand Up @@ -281,6 +287,8 @@
Base,
);
mainGroup = ACA3A12C20E2F6AF00FEF74F;
packageReferences = (
);
productRefGroup = ACA3A13620E2F6AF00FEF74F /* Products */;
projectDirPath = "";
projectRoot = "";
Expand Down Expand Up @@ -592,6 +600,14 @@
/* End XCConfigurationList section */

/* Begin XCSwiftPackageProductDependency section */
37088F322B3C38250000B218 /* IterableAppExtensions */ = {
isa = XCSwiftPackageProductDependency;
productName = IterableAppExtensions;
};
37088F342B3C38250000B218 /* IterableSDK */ = {
isa = XCSwiftPackageProductDependency;
productName = IterableSDK;
};
551A5FF0251AB1950004C9A0 /* IterableSDK */ = {
isa = XCSwiftPackageProductDependency;
productName = IterableSDK;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
config.customActionDelegate = self
config.urlDelegate = self
config.inAppDisplayInterval = 1

config.anonUserDelegate = self
IterableAPI.initialize(apiKey: iterableApiKey,
launchOptions: launchOptions,
config: config)
Expand Down Expand Up @@ -157,6 +157,12 @@ extension AppDelegate: IterableURLDelegate {
}
}

extension AppDelegate: IterableAnonUserDelegate {
func onAnonUserCreated(userId: String) {
print("UserId Created from anonsession: \(userId)")
}
}

// MARK: IterableCustomActionDelegate

extension AppDelegate: IterableCustomActionDelegate {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="22505" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="umW-9Q-hvM">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="32700.99.1234" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="umW-9Q-hvM">
<device id="retina4_7" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22504"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22685"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="collection view cell content view" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
Expand All @@ -19,7 +19,7 @@
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<color key="tintColor" red="0.31372549020000001" green="0.71372549019999998" blue="0.98823529409999999" alpha="1" colorSpace="calibratedRGB"/>
<view key="tableFooterView" contentMode="scaleToFill" id="VEA-om-wVt">
<rect key="frame" x="0.0" y="121.5" width="375" height="44"/>
<rect key="frame" x="0.0" y="165" width="375" height="44"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</view>
Expand All @@ -35,6 +35,14 @@
<segue destination="Ez8-MY-tka" kind="show" identifier="showCoffeeSegue" id="pgY-3d-VNl"/>
</connections>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" accessoryType="checkmark" indentationWidth="10" reuseIdentifier="anonymousUsageTrackCell" id="nSd-28-WlN">
<rect key="frame" x="0.0" y="93.5" width="375" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="nSd-28-WlN" id="4YR-d9-FwM">
<rect key="frame" x="0.0" y="0.0" width="335" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
</tableViewCellContentView>
</tableViewCell>
</prototypes>
<connections>
<outlet property="dataSource" destination="AsM-Cj-iLA" id="zCP-mf-9X0"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,22 +60,42 @@ class CoffeeListTableViewController: UITableViewController {
}

// MARK: - TableViewDataSourceDelegate Functions

override func tableView(_: UITableView, numberOfRowsInSection _: Int) -> Int {
filtering ? filteredCoffees.count : coffees.count
override func numberOfSections(in tableView: UITableView) -> Int {
return 2
}
override func tableView(_: UITableView, numberOfRowsInSection section: Int) -> Int {
if section == 0 {
return 1
} else {
return filtering ? filteredCoffees.count : coffees.count
}

}

override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "coffeeCell", for: indexPath)

let coffeeList = filtering ? filteredCoffees : coffees
let coffee = coffeeList[indexPath.row]
cell.textLabel?.text = coffee.name
cell.imageView?.image = coffee.image

return cell
if indexPath.section == 0 {
let cell = tableView.dequeueReusableCell(withIdentifier: "anonymousUsageTrackCell", for: indexPath)
cell.textLabel?.text = IterableAPI.getAnonymousUsageTracked() ? "Tap to enable Anonymous Usage Track" : "Tap to disable Anonymous Usage Track"
cell.textLabel?.numberOfLines = 0
cell.accessoryType = IterableAPI.getAnonymousUsageTracked() ? .checkmark : .none
return cell
} else {
let cell = tableView.dequeueReusableCell(withIdentifier: "coffeeCell", for: indexPath)
let coffeeList = filtering ? filteredCoffees : coffees
let coffee = coffeeList[indexPath.row]
cell.textLabel?.text = coffee.name
cell.imageView?.image = coffee.image
return cell
}
}


override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if indexPath.section == 0 {
let permissionToTrack = IterableAPI.getAnonymousUsageTracked()
IterableAPI.setAnonymousUsageTracked(isAnonymousUsageTracked: !permissionToTrack)
self.tableView.reloadData()
}
}

// MARK: Tap Handlers

@IBAction func loginOutBarButtonTapped(_: UIBarButtonItem) {
Expand All @@ -93,7 +113,7 @@ class CoffeeListTableViewController: UITableViewController {
// MARK: - Navigation

override func prepare(for segue: UIStoryboardSegue, sender _: Any?) {
guard let indexPath = tableView.indexPathForSelectedRow else {
guard let indexPath = tableView.indexPathForSelectedRow, indexPath.section == 1 else {
return
}

Expand Down
Loading
Loading