Commit 21cf543
Auto-populate event_source_url from CAPI ParamBuilder
Summary:
# Problem
`com.facebook.capi.sdk:capi-param-builder` 1.3.0 (D106968654) exposes
`ParamBuilder.getEventSourceUrl()`, and the Java SDK's `Preference` now
has the `is_event_source_url_allowed` gate (D106971535). What is still
missing is the wiring in `Event` itself: callers who do
`event.setRequestContext(request)` get fbc / fbp handled by
`applyParamBuilderDefaults()` but `event_source_url` is never
auto-populated. This mirrors the Node.js wiring in D106966732, the PHP
wiring in D106907292, the Ruby wiring in D106704065, and the Python
wiring in D106698649.
# Solution
Extend `Event.applyParamBuilderDefaults()` so that after the existing
UserData fbc/fbp handling it also reads
`paramBuilder.getEventSourceUrl()` and assigns it to the event's
`eventSourceUrl` when:
- `preference.isEventSourceUrlAllowed()` is `true` (default), AND
- `eventSourceUrl` is currently null or empty (caller-supplied values
always win, matching the precedence rule for fbc/fbp), AND
- the builder returned a non-empty URL.
Update the method docstring — it now fills empty `UserData` fields AND
empty `Event` fields.
Consistent with the existing fbc/fbp handling, this is wired and
unit-tested via a mocked `ParamBuilder`, but is a runtime no-op until
the deferred `paramBuilder.processRequestFromContext(context)` call in
`setRequestContext` is re-enabled (see the NOTE there). That deferral
was waiting on the Maven Central release of `capi-param-builder` to
publish the request-context methods, which the 1.3.0 bump (D106968654)
now satisfies; re-enabling the call (and the matching real-builder
guardrail assertions) is a separate follow-up, so this diff keeps the
event_source_url wiring in lock-step with how fbc/fbp are handled
today rather than changing that behavior here.
Differential Revision: D106972051
fbshipit-source-id: ee214cff0fcc2ee11a36e363b5d6431b7b4e40bb1 parent cbbe155 commit 21cf543
2 files changed
Lines changed: 69 additions & 3 deletions
File tree
- src
- main/java/com/facebook/ads/sdk/serverside
- test/java/com/facebook/ads/sdk/serverside
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
638 | 638 | | |
639 | 639 | | |
640 | 640 | | |
641 | | - | |
642 | | - | |
643 | | - | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
644 | 644 | | |
645 | 645 | | |
646 | 646 | | |
| |||
667 | 667 | | |
668 | 668 | | |
669 | 669 | | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
670 | 677 | | |
671 | 678 | | |
672 | 679 | | |
| |||
Lines changed: 59 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
| 87 | + | |
87 | 88 | | |
88 | 89 | | |
89 | 90 | | |
| |||
203 | 204 | | |
204 | 205 | | |
205 | 206 | | |
| 207 | + | |
206 | 208 | | |
207 | 209 | | |
208 | 210 | | |
| |||
217 | 219 | | |
218 | 220 | | |
219 | 221 | | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
220 | 279 | | |
221 | 280 | | |
222 | 281 | | |
| |||
0 commit comments