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

Add warning messages for publishers while native ads send assets containing url without sendId #5096

Merged
merged 2 commits into from
Apr 22, 2020

Conversation

bmwcmw
Copy link
Collaborator

@bmwcmw bmwcmw commented Apr 8, 2020

Type of change

  • Bugfix
  • Feature
  • New bidder adapter
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Does this change affect user-facing APIs or examples documented on http://prebid.org?
  • Other

Description of change

Following the updated documentation, we want to drop a warning to tell that sendid is mandatory for all fields receiving URLs, notably: product images, clickUrl, logoimage

  • test parameters for validating bids
pbjs.addAdUnits([{
    ...
    mediaTypes: {
        native: {
            image: {
                required: true,
                sendId: false //false to see the warning
            },
            icon: {
                required: true,
                sendId: false
            },
            clickUrl: {
                required: true,
                sendId: false
            },
            displayUrl: {
                required: true,
                sendId: false
            },
            privacyLink: {
                required: true,
                sendId: false
            },
            privacyIcon: {
                required: true,
                sendId: false
            }
            //other assets will not trigger the warning
        }
    },     
...

@bmwcmw
Copy link
Collaborator Author

bmwcmw commented Apr 15, 2020

Hi @jsnellbaker @robertrmartinez, I'd like to know is there any blocking point for this? Many thanks :)

@robertrmartinez
Copy link
Collaborator

Hi @bmwcmw I have not had a chance to take a look at this yet but will do so soon.

Usually we recommend adding a test for any PR to make sure we do not lag behind on the required 80% coverage for each adapter. So if you could please add an associated test for this change that would be great!

@bmwcmw
Copy link
Collaborator Author

bmwcmw commented Apr 16, 2020

Thank you @robertrmartinez , just added a unit test on it

Copy link
Collaborator

@robertrmartinez robertrmartinez left a comment

Choose a reason for hiding this comment

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

Not sure the change does what is intended.

Can you please point out if I am missing something?

@@ -279,6 +291,7 @@ function buildCdbRequest(context, bidRequests, bidderRequest) {
}
if (bidRequest.params.nativeCallback || utils.deepAccess(bidRequest, `mediaTypes.${NATIVE}`)) {
slot.native = true;
hasNativeSendId = hasNativeSendId || checkNativeSendId(bidRequest);
Copy link
Collaborator

Choose a reason for hiding this comment

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

I am not sure this ever will run the checkNativeSendId function?

On line 266 you are explicitly setting hasNativeSendId to true which means it will always short circuit in this OR operator and not run the checkNativeSendId.

Am I missing something?

image

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's updated with improved tests, thanks for the pointing out.

Copy link
Collaborator

@robertrmartinez robertrmartinez left a comment

Choose a reason for hiding this comment

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

Cool stuff!

Thanks for the patience!

@robertrmartinez robertrmartinez merged commit 0decdce into prebid:master Apr 22, 2020
@bmwcmw bmwcmw deleted the nativewarn branch April 23, 2020 08:58
iggyfisk pushed a commit to happypancake/Prebid.js that referenced this pull request Jun 22, 2020
…aining url without sendId (prebid#5096)

* Check sendId parameter for native ads and warn if missing on required assets

* Extract checking method and test

Co-authored-by: mi.chen <mi.chen@criteo.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants