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 custom conversion ID patterns for Verifiable Advertiser Conversions #8640

Merged
merged 1 commit into from
Apr 29, 2021

Conversation

moritzhaller
Copy link
Contributor

@moritzhaller moritzhaller commented Apr 26, 2021

Resolves brave/brave-browser#15491

Submitter Checklist:

  • I confirm that no security/privacy review is needed, or that I have requested one
  • There is a ticket for my issue
  • Used Github auto-closing keywords in the PR description above
  • Wrote a good PR/commit description
  • Added appropriate labels (QA/Yes or QA/No; release-notes/include or release-notes/exclude; OS/...) to the associated issue
  • Checked the PR locally: npm run test -- brave_browser_tests, npm run test -- brave_unit_tests, npm run lint, npm run gn_check, npm run tslint
  • Ran git rebase master (if needed)

Reviewer Checklist:

  • A security review is not needed, or a link to one is included in the PR description
  • New files have MPL-2.0 license header
  • Adequate test coverage exists to prevent regressions
  • Major classes, functions and non-trivial code blocks are well-commented
  • Changes in component dependencies are properly reflected in gn
  • Code follows the style guide
  • Test plan is specified in PR before merging

After-merge Checklist:

Test Plan:

VAC - DOM

  • Mock catalog_dom.json for catalog
  • Set up mock conversion page on localhost. This page has to match the key in the resource (see step 2).
  • Start browser on fresh profile with ads enabled. Wait for ads resources components to download and quit.
  • Once downloaded, add mock resource for custom VAC scripts (see vendor/bat-native-ads/data/test/resources/nnqccijfhvzwyrxpxwjrpmynaiazctqb) and add to resources.json.
  • Start browser again and make sure the resource got initialised with conversions_resource.cc(36)] Successfully loaded ...
  • Trigger an ad notification (set up catalog such that ad with VAC conversion triggers).
  • Go to conversion page (https://brave.com/careers/) and trigger a conversion, which now should extract the custom ID according to the regex pattern in the resource.
  • Verify that conversion ID was extracted by looking up the value in the DB (conversion queue table).

Conversion ID: foo-12345

VAC - URL

  • Mock catalog_url.json for catalog
  • Set up mock conversion page on localhost. This page has to match the key in the resource (see step 2).
  • Start browser on fresh profile with ads enabled. Wait for ads resources components to download and quit.
  • Once downloaded, add mock resource for custom VAC scripts (see vendor/bat-native-ads/data/test/resources/nnqccijfhvzwyrxpxwjrpmynaiazctqb) and add to resources.json.
  • Start browser again and make sure the resource got initialised with conversions_resource.cc(36)] Successfully loaded ...
  • Trigger an ad notification (set up catalog such that ad with VAC conversion triggers).
  • Go to conversion page (https://www.nytimes.com/section/world?conversion_id=baz-987-xyz) and trigger a conversion, which now should extract the custom ID according to the regex pattern in the resource.
  • Verify that conversion ID was extracted by looking up the value in the DB (conversion queue table).

Conversion ID: baz-987-xyz

VAC files.zip

To increase adoption of Verifiable Advertiser Conversions we provide a mechanism to extract a conversion ID from an advertiser's conversion site w/o the need to modify its DOM. To this end a regex pattern can be configured via the conversions resource to extract the ID from either the URL or the DOM. The default pattern has been made configurable via griffin.
"search_in": "url"
}
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: newline at end of file, otherwise github complains, see above

ConversionIdPatternMap conversion_id_patterns = resource.get();

// Assert
EXPECT_EQ(2u, conversion_id_patterns.size());
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: 2U

Copy link
Collaborator

@tmancey tmancey left a comment

Choose a reason for hiding this comment

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

LGTM++

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.

Add custom scripts for Verifiable Advertiser Conversions
3 participants