refactor ad code and dont show ads on embeds (#290)
This commit is contained in:
parent
f084288ac9
commit
6546eaeb63
3 changed files with 4 additions and 4 deletions
|
@ -51,7 +51,7 @@ const hitsAtFiftyPercentChance = hitsFiftyPercent();
|
|||
* @param allowPreRoll
|
||||
* @param player
|
||||
*/
|
||||
function runAds(internalFeatureEnabled, allowPreRoll, player) {
|
||||
function runAds(internalFeatureEnabled, allowPreRoll, player, embedded) {
|
||||
// current timestamp for vpaid
|
||||
const timestamp = new Date().toISOString();
|
||||
|
||||
|
@ -83,7 +83,7 @@ function runAds(internalFeatureEnabled, allowPreRoll, player) {
|
|||
// always have ads on if internal feature is on,
|
||||
// otherwise if not authed, roll for 20% to see an ad
|
||||
// allowPreRoll currently means unauthenticated (don't show to logged in users)
|
||||
const shouldShowAnAd = internalFeatureEnabled || (allowPreRoll && hitsAtFiftyPercentChance);
|
||||
const shouldShowAnAd = internalFeatureEnabled || (!embedded && allowPreRoll && hitsAtFiftyPercentChance);
|
||||
|
||||
if (shouldShowAnAd && browserIsChrome && !IS_MOBILE) {
|
||||
// fire up ima integration via module
|
||||
|
|
|
@ -183,7 +183,7 @@ export default React.memo<Props>(function VideoJs(props: Props) {
|
|||
// this seems like a weird thing to have to check for here
|
||||
if (!player) return;
|
||||
|
||||
runAds(internalFeatureEnabled, allowPreRoll, player);
|
||||
runAds(internalFeatureEnabled, allowPreRoll, player, embedded);
|
||||
|
||||
initializeEvents();
|
||||
|
||||
|
|
|
@ -470,7 +470,7 @@ function VideoViewer(props: Props) {
|
|||
autoplaySetting={autoplayNext}
|
||||
claimId={claimId}
|
||||
userId={userId}
|
||||
allowPreRoll={!authenticated} // used to not include embeds, removed for now
|
||||
allowPreRoll={!authenticated} // TODO: pull this into ads functionality so it's self contained
|
||||
internalFeatureEnabled={internalFeature}
|
||||
shareTelemetry={shareTelemetry}
|
||||
replay={replay}
|
||||
|
|
Loading…
Reference in a new issue