-
Notifications
You must be signed in to change notification settings - Fork 53
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
[WIP] Add AWS Amazon Personalize as a Provider for the Recommended Content Feature #790
base: develop
Are you sure you want to change the base?
Conversation
…be shared. Other updates to make it easier for the Feature to support multiple Providers. Add initial render function
…vent tracking request to AWS
…d those post IDs off to AWS to rerank them and then render the reranked results
@jeffpaul The dependency review workflow is failing on this PR: https://github.com/10up/classifai/actions/runs/10221897513/job/28285404935?pr=790#step:3:11. Looking at the licenses it's flagging (Apache-2.0 and MIT) seems both of those should be allowed based off our config: https://github.com/10up/.github/blob/trunk/.github/dependency-review-config.yml I'm not familiar enough with this action to know if this is an issue with that, an issue with our config or something else that needs fixed up |
return new WP_Error( 'client_not_found', esc_html__( 'Client not found.', 'classifai' ) ); | ||
} | ||
|
||
$id = uniqid(); // TODO: Is this the best way to generate a session ID? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will create a new ID for every event. We'll need to generate a session ID that remains the same through the session. We can do something like the following?
add_action( 'init', function() {
if ( ! session_id() ) {
session_start();
}
} );
Few points from the docs:
- Your application generates a unique
sessionId
when a user first visits your website or uses your application. You must use the samesessionId
in all events throughout the session. Amazon Personalize uses thesessionId
to associate events with the user before they log in (is anonymous). - To provide real-time personalization for anonymous users, specify the
sessionId
as theuserId
in yourGetRecommendations
orGetActionRecommendations
request.
], | ||
'sessionId' => $id, | ||
'trackingId' => $settings['event_tracker_id'] ?? '', | ||
'userId' => $id, // TODO: We need a user ID that can be tracked across page views. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For logged-in users, can this be the value returned by get_current_user_id()
, something like:
'userId' => get_current_user_id() ?? session_id(),
@jeffpaul, I'm seeing a similar failure in PR #771 as well. I'm not sure of the exact reason for this. Could it be because |
Description of the Change
Currently the only Provider we have for the Recommended Content Feature is Azure Personalizer. That Provider has been deprecated by Azure and is no longer available to use. In doing lots of research, a fairly close drop-in replacement is AWS Amazon Personalize. This PR adds a new Provider for that.
Worth noting there are lots of use cases that Amazon Personalize provides, some more out of the box and some that require a bit more setup. This PR is focusing on the Personalized Ranking recipe as that very closely matches what we were doing with Azure Personalizer. We could look to support other use cases in the future though.
Closes #
How to test the Change
More to come
Changelog Entry
Credits
Props @dkotter, @Sidsector9
Checklist: