-
Notifications
You must be signed in to change notification settings - Fork 230
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
feat: ad repeat logic #3894
base: main
Are you sure you want to change the base?
feat: ad repeat logic #3894
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Skipped Deployment
|
Still work in progress but initial logic can be reviewed. |
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.
Overall direction looks good!
@@ -423,7 +423,6 @@ describe('Feed logged in', () => { | |||
edges: [defaultFeedPage.edges[0]], | |||
}), | |||
]); | |||
await screen.findByTestId('adItem'); |
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.
With current logic even though adSpot
would be 2 (which means only show ads after 2 posts) we would still show the ad after only once post.
Example with feed page with only one post:
With new logic it correctly does not show ad until enough posts are listed:
Verified with @idoshamun its ok behaviour.
4d9e9f3
to
8fb5130
Compare
export type FeedAdTemplate = { | ||
adStart: number; | ||
adRepeat?: number; | ||
}; |
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.
I can make this Record<screen_size, FeedAdTemplate>
if we want to customize per tablet/mobile/laptop.
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.
Yeah think we need to right, to control existing behaviour?
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.
Current adSpot
, behaviour is static and not per screen size
apps/packages/shared/src/components/Feed.tsx
Line 173 in ca508b4
isSquadFeed || shouldUseListFeedLayout ? 2 : adSpot, |
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 list and squad we use always 2
so I left that as is since the previous implementation also did not touch it.
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.
Sorry not adSpot but adRepeat is dynamic per pagesize now right?
So if we experiment it needs to support screensizes out of box?
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.
Don't have much to add!
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.
Code wise good, but think we need the screen sizes in the flag to mimic current behaviour.
export type FeedAdTemplate = { | ||
adStart: number; | ||
adRepeat?: number; | ||
}; |
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.
Yeah think we need to right, to control existing behaviour?
@@ -47,4 +48,8 @@ export const featureOnboardingSources = new Feature( | |||
false, | |||
); | |||
|
|||
export const featureFeedAdTemplate = new Feature('feed_ad_template', { | |||
adStart: 2, |
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.
Doesn't this need default position as well here? (to mimic current pagesize)
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.
Since it depends on pageSize I added a default fallback inside useFeed when adRepeat is undefined
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.
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.
Once adRepeat
comes from GB page size does not matter anymore
Changes
TODO
Logic example, params are
[adStart, adRepeat]
.adStart
defaults to oldadSpot
param,adRepeat
will default topageSize + 1
for backward compatibility.P
is post,A
is ad in examples.[2, 9]
, page size 8 (backward compatibility example, one ad per page)[2, 3]
, page size 8 (new example, more ads per page, ad shows every 3th post after initialadStart
offset)Events
Did you introduce any new tracking events?
Experiment
Did you introduce any new experiments?
Manual Testing
Caution
Please make sure existing components are not breaking/affected by this PR
Preview domain
https://ad-repeat-logic.preview.app.daily.dev