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

[MOB-6216] implement impression tracking listeners #576

Conversation

evantk91
Copy link
Contributor

@evantk91 evantk91 commented Jun 3, 2023

🔹 Jira Ticket(s) if any

✏️ Description

  • Implements impression tracking listeners in the embedded session handler
  • Associated changes to the tester app have been added and are located on the embedded-session-tracking branch
  • The SDK currently prints a log statement when impressions start and end
  • The next pull request will add the processing for this data

@evantk91 evantk91 changed the base branch from feature/embedded/EmbeddedSessionManager to feature/embedded/EmbeddedSessionManager-MOB-6232-create-embedded-session-manager June 3, 2023 15:47
@evantk91 evantk91 changed the title [MOB-6232] implement impression tracking listeners [MOB-6216] implement impression tracking listeners Jun 3, 2023
Copy link
Member

@Ayyanchira Ayyanchira left a comment

Choose a reason for hiding this comment

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

Is it not a interface overridden methods?
The terminology on Android - onMessageImpression with on prefix usually says its an interface overriden method.
If its not supposed to be that, we can just call it - startMessageImpression. Just a thought.

Base automatically changed from feature/embedded/EmbeddedSessionManager-MOB-6232-create-embedded-session-manager to feature/embedded/EmbeddedSessionManager June 14, 2023 18:02
@evantk91
Copy link
Contributor Author

I am using the convention from in-app. should we do a revisit on a separate PR?

@evantk91 evantk91 requested a review from Ayyanchira June 14, 2023 18:47
evan.greer@iterable.com and others added 3 commits June 14, 2023 13:54
…dSessionManager-MOB-6232-implement-impression-tracking-listeners
…mbedded/EmbeddedSessionManager-MOB-6232-implement-impression-tracking-listeners
* sets up embedded impression data class for calculating duration and display counts

* sets up impression tracking functions

* adds impression data manipulation to session manager

---------

Co-authored-by: evan.greer@iterable.com <evan.greer@evan.greer>
@evantk91 evantk91 merged commit bd75493 into feature/embedded/EmbeddedSessionManager Jun 14, 2023
3 of 4 checks passed
@evantk91 evantk91 deleted the feature/embedded/EmbeddedSessionManager-MOB-6232-implement-impression-tracking-listeners branch June 14, 2023 21:39
evantk91 added a commit that referenced this pull request Jun 14, 2023
* creates embedded session manager startSession and endSession

* removes print statements

* [MOB-6216] implement impression tracking listeners (#576)

* adds impression handlers to embedded session manager

* [MOB-6217] implement impression tracking functions (#577)

* sets up embedded impression data class for calculating duration and display counts

* sets up impression tracking functions

* adds impression data manipulation to session manager

---------

Co-authored-by: evan.greer@iterable.com <evan.greer@evan.greer>

---------

Co-authored-by: evan.greer@iterable.com <evan.greer@evan.greer>

---------

Co-authored-by: evan.greer@iterable.com <evan.greer@evan.greer>
Ayyanchira added a commit that referenced this pull request Jun 15, 2023
* adds base embedded manager

* creates separate json file for test embedded message payload

* reads message json from file

* Base manager class

Iterable API initializes with embeddedmanager in memory
constants class now have a constant to hit the right API
embeddedmanager now has listeners interfaces and getter setter placeholders.
It also has a timer placeholder. Not functional yet though
Requestprocessor has offline mode assigned to embedded messages as well.
embeddedmanager makes an api call. Incomplete state as of now

* [MOB-5762] - Time based AutoSync

Schedule sync happens after every determined duration.
Still not perfect. Especially in situation of going to background and coming to foreground in time less than the autofetch interval. Possiblity of multiple looper posts

* Delete json file in package

* [MOB-5785] - Sync remote embedded messages

1. update the local list of messages with remote messages instead of directly assigning remote message to local list.
2. Keep placeholder places for places to call delivery and deletion where new message is identified and old message is identified gotten deleted

* Fix Tests

* Fixes a bug

Fixes a bug where SDK would not resume the sync thinking there is already a sync scheduled but was indeed skipped due to app in background.

* Adjusting TODO as per comments

* [MOB - 5764] - Renaming

Renaming autoFetchInterval names as per last PR suggestion

* Removing comments and making it work with api

* updates logs and parsing of incoming payload

* minor edits

* adds live data for local messages queue

* adds mock embedded manager

* Replacing hardcoded email with logged in email.

Also adding a todo

* Adding TODO for placementId

* onMessageUpdate implementation

* [MOB-5983] - Refactor code

* removes redundant getEmbeddedManager call

* removes test function from manager

* rename route

* adds boundary to auto fetching

* minor edits

* minor edits

* removes autoFetchDuration from scheduleSync signature

* adds called to custom track event

* sets up click tracking using custom track event

* rename for consistency

* adds button identifier to the embedded click signature

* adds button identifier to custom event payload

* adds buttonIdentifier to trackEmbeddedClick call on IterableApiClient

* addresses comments

* aligns click event with corresponding iOS call

* removes log statement

* addes serialization of button action

* updates message id throughout SDK

* changes message id back to work with current backend

* sets up trackEmbeddedMessageReceived function in IterableApiClient

* removes custom event call

* sets up embedded message received unit test

* refactors assigning of userKey for embedded calls

* adds connection to associated endpoint

* removes jacoco.exec

* updates .gitignore and refactor

* Connects track embedded message click to endpoint

* [MOB-6135] - Check SDK initialization before API call

Similar implementation to getInAppMessages where SDK initialization is checked before making a call to API

* Comment changes

* addresses comments

* updates addEmailOrUserIdToUserKeyJson method signatures across analytics calls

* adds dependency

* removes redundant dependency

* sets up connection to impression tracking endpoint

* adds embedded session test

* addresses checkstyle comment

* updates impression tracking payload

* updates session id

* removes non-null annotation

* updates payload constants

* updates session payload

* addresses unit test error

* unit test fixes

* addresses check

* adds missing dependency

* remove dependency

* updates message id to match backend update

* Revert "updates message id to match backend update"

This reverts commit d0be2a9.

* updates message id across SDK

* updates IterableApiClient

* updates tests with message id:q

* updates embedded payloads to include email or userid fields

* [MOB - 6363] - Merge embedded session manager to Manager (#585)

* creates embedded session manager startSession and endSession

* removes print statements

* [MOB-6216] implement impression tracking listeners (#576)

* adds impression handlers to embedded session manager

* [MOB-6217] implement impression tracking functions (#577)

* sets up embedded impression data class for calculating duration and display counts

* sets up impression tracking functions

* adds impression data manipulation to session manager

---------

Co-authored-by: evan.greer@iterable.com <evan.greer@evan.greer>

---------

Co-authored-by: evan.greer@iterable.com <evan.greer@evan.greer>

---------

Co-authored-by: evan.greer@iterable.com <evan.greer@evan.greer>

* [MOB - 6115] EM feature flagging (#578)

* [MOB-6115] - Feature flagging EM

* scheduling next call for other types of failures

* Adding Invalid Api Key in the gate too

This will prevent app with invalid api key to not unnecessarily make EM requests

* adds isEmbeddedEnabled flag for testing purposes

* sets up auto fetch duration as a livedata

* Revert "sets up auto fetch duration as a livedata"

This reverts commit 5f5178c.

* Revert "adds isEmbeddedEnabled flag for testing purposes"

This reverts commit 6bb17a7.

* Modifying the method call

* [MOB - 6362] Update subscription status (#586)

* New interface method

* Fixing Test

Setting EmbeddedMessaging disabled for test

---------

Co-authored-by: “Akshay <“ayyanchira.akshay@gmail.com”>

---------

Co-authored-by: “Akshay <“ayyanchira.akshay@gmail.com”>
Co-authored-by: evan.greer@iterable.com <evan.greer@evan.greer>

---------

Co-authored-by: Evan Greer <evan.greer@iterable.com>
Co-authored-by: “Akshay <“ayyanchira.akshay@gmail.com”>
Co-authored-by: evan.greer@iterable.com <evan.greer@evan.greer>
Co-authored-by: Evan Takeo Kanaiaupuni Greer <56953678+evantk91@users.noreply.github.com>
Ayyanchira pushed a commit that referenced this pull request Jun 16, 2023
commit 82f4d6b
Author: Akshay Ayyanchira <ayyanchira.akshay@gmail.com>
Date:   Thu Jun 15 09:42:53 2023 -0700

    Feature/embedded/manager (#527)

    * adds base embedded manager

    * creates separate json file for test embedded message payload

    * reads message json from file

    * Base manager class

    Iterable API initializes with embeddedmanager in memory
    constants class now have a constant to hit the right API
    embeddedmanager now has listeners interfaces and getter setter placeholders.
    It also has a timer placeholder. Not functional yet though
    Requestprocessor has offline mode assigned to embedded messages as well.
    embeddedmanager makes an api call. Incomplete state as of now

    * [MOB-5762] - Time based AutoSync

    Schedule sync happens after every determined duration.
    Still not perfect. Especially in situation of going to background and coming to foreground in time less than the autofetch interval. Possiblity of multiple looper posts

    * Delete json file in package

    * [MOB-5785] - Sync remote embedded messages

    1. update the local list of messages with remote messages instead of directly assigning remote message to local list.
    2. Keep placeholder places for places to call delivery and deletion where new message is identified and old message is identified gotten deleted

    * Fix Tests

    * Fixes a bug

    Fixes a bug where SDK would not resume the sync thinking there is already a sync scheduled but was indeed skipped due to app in background.

    * Adjusting TODO as per comments

    * [MOB - 5764] - Renaming

    Renaming autoFetchInterval names as per last PR suggestion

    * Removing comments and making it work with api

    * updates logs and parsing of incoming payload

    * minor edits

    * adds live data for local messages queue

    * adds mock embedded manager

    * Replacing hardcoded email with logged in email.

    Also adding a todo

    * Adding TODO for placementId

    * onMessageUpdate implementation

    * [MOB-5983] - Refactor code

    * removes redundant getEmbeddedManager call

    * removes test function from manager

    * rename route

    * adds boundary to auto fetching

    * minor edits

    * minor edits

    * removes autoFetchDuration from scheduleSync signature

    * adds called to custom track event

    * sets up click tracking using custom track event

    * rename for consistency

    * adds button identifier to the embedded click signature

    * adds button identifier to custom event payload

    * adds buttonIdentifier to trackEmbeddedClick call on IterableApiClient

    * addresses comments

    * aligns click event with corresponding iOS call

    * removes log statement

    * addes serialization of button action

    * updates message id throughout SDK

    * changes message id back to work with current backend

    * sets up trackEmbeddedMessageReceived function in IterableApiClient

    * removes custom event call

    * sets up embedded message received unit test

    * refactors assigning of userKey for embedded calls

    * adds connection to associated endpoint

    * removes jacoco.exec

    * updates .gitignore and refactor

    * Connects track embedded message click to endpoint

    * [MOB-6135] - Check SDK initialization before API call

    Similar implementation to getInAppMessages where SDK initialization is checked before making a call to API

    * Comment changes

    * addresses comments

    * updates addEmailOrUserIdToUserKeyJson method signatures across analytics calls

    * adds dependency

    * removes redundant dependency

    * sets up connection to impression tracking endpoint

    * adds embedded session test

    * addresses checkstyle comment

    * updates impression tracking payload

    * updates session id

    * removes non-null annotation

    * updates payload constants

    * updates session payload

    * addresses unit test error

    * unit test fixes

    * addresses check

    * adds missing dependency

    * remove dependency

    * updates message id to match backend update

    * Revert "updates message id to match backend update"

    This reverts commit d0be2a9.

    * updates message id across SDK

    * updates IterableApiClient

    * updates tests with message id:q

    * updates embedded payloads to include email or userid fields

    * [MOB - 6363] - Merge embedded session manager to Manager (#585)

    * creates embedded session manager startSession and endSession

    * removes print statements

    * [MOB-6216] implement impression tracking listeners (#576)

    * adds impression handlers to embedded session manager

    * [MOB-6217] implement impression tracking functions (#577)

    * sets up embedded impression data class for calculating duration and display counts

    * sets up impression tracking functions

    * adds impression data manipulation to session manager

    ---------

    Co-authored-by: evan.greer@iterable.com <evan.greer@evan.greer>

    ---------

    Co-authored-by: evan.greer@iterable.com <evan.greer@evan.greer>

    ---------

    Co-authored-by: evan.greer@iterable.com <evan.greer@evan.greer>

    * [MOB - 6115] EM feature flagging (#578)

    * [MOB-6115] - Feature flagging EM

    * scheduling next call for other types of failures

    * Adding Invalid Api Key in the gate too

    This will prevent app with invalid api key to not unnecessarily make EM requests

    * adds isEmbeddedEnabled flag for testing purposes

    * sets up auto fetch duration as a livedata

    * Revert "sets up auto fetch duration as a livedata"

    This reverts commit 5f5178c.

    * Revert "adds isEmbeddedEnabled flag for testing purposes"

    This reverts commit 6bb17a7.

    * Modifying the method call

    * [MOB - 6362] Update subscription status (#586)

    * New interface method

    * Fixing Test

    Setting EmbeddedMessaging disabled for test

    ---------

    Co-authored-by: “Akshay <“ayyanchira.akshay@gmail.com”>

    ---------

    Co-authored-by: “Akshay <“ayyanchira.akshay@gmail.com”>
    Co-authored-by: evan.greer@iterable.com <evan.greer@evan.greer>

    ---------

    Co-authored-by: Evan Greer <evan.greer@iterable.com>
    Co-authored-by: “Akshay <“ayyanchira.akshay@gmail.com”>
    Co-authored-by: evan.greer@iterable.com <evan.greer@evan.greer>
    Co-authored-by: Evan Takeo Kanaiaupuni Greer <56953678+evantk91@users.noreply.github.com>
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.

None yet

2 participants