insideall / dfp-prebid-lineitems Goto Github PK
View Code? Open in Web Editor NEWA PHP script to setup and update your Prebid Line Items in DFP
A PHP script to setup and update your Prebid Line Items in DFP
If you already have key values on existing line items but need to set this up with the same SSP, there's evidently no choice but to make an entirely new set of keys or rename the SSP.
I'd like to get one set of key values for my entire account then reference those in future implementations. My current provider uses hb_pb only as opposed to hb_pb_ssp - so i already have that portion, just need them attached to new line items for various sites. I did figure out how to remove the _SSP portion myself.
I have fumbled around a lot, but can't get it to just accept the existing keys though it appears to check for their existence. If there was some line I could comment out to stop it from throwing this error, that'd help a lot.
When the error hits you get a couple thousand lines of XML that reference all the key values, based on the granularity you chose, which ends with this:
PHP Fatal error: Uncaught Google\AdsApi\Dfp\v201802\ApiException: [CustomTargetingError.VALUE_NAME_DUPLICATE @ name; trigger:'0.01', CustomTargetingError.VALUE_NAME_DUPLICATE @ name; trigger:'0.02', CustomTargetingError.VALUE_NAME_DUPLICATE @ name; trigger:'0.03', CustomTargetingError.VALUE_NAME_DUPLICATE @ name; trigger:'0.04', CustomTargetingError.VALUE_NAME_DUPLICATE @ name; trigger:'0.10', CustomTargetingError.VALUE_NAME_DUPLICATE @ name; trigger:'0.25', CustomTargetingError.VALUE_NAME_DUPLICATE @ name; trigger:'0.50', CustomTargetingError.VALUE_NAME_DUPLICATE @ name; trigger:'0.75', CustomTargetingError.VALUE_NAME_DUPLICATE @ name; trigger:'1.10', CustomTargetingError.VALUE_NAME_DUPLICATE @ name; trigger:'1.21', CustomTargetingError.VALUE_NAME_DUPLICATE @ name; trigger:'1.32', CustomTargetingError.VALUE_NAME_DUPLICATE @ name; trigger:'1.43', CustomTargetingError.VALUE_NAME_DUPLICATE @ name; trigger:'1.55', CustomTargetingError.VALUE_NAME_DUPLICATE @ name; trigger:'1.66', CustomTargetingError.VALUE_NAME_DUPLICATE @ name; in D:\Website\dfp-prebid-lineitems-master\dfp-prebid-lineitems-master\vendor\googleads\googleads-php-lib\src\Google\AdsApi\Common\Util\Reflection.php on line 43
Shall I send a pull request after fixing the coding style using PHP-CS-Fixer?
As stated by php docs, the bccomp function takes two strings to perform the comparison.
The code is using numeric values directly, which causes some values to fail the comparison and therefore, some line items will be missing.
to fix that, the bccomp functions need to have the operands converted to strings:
for ($i = $value['min']; bccomp(sprintf('%F', $i), sprintf('%F', $value['max']), $precision) <= 0; $i += $value['increment']) {
if ($i > 0 && 0 !== bccomp(sprintf('%F', $i), sprintf('%F', $lastValue), 2)) {
array_push($buckets, sprintf("%0.{$precision}f", $i));
}
$lastValue = $i;
}
Looks like the following path in ConnexionTest.php
was missed during a renaming effort:
$traffickerId = (new \App\Dfp\UserManager())->getUserId();
Should be:
$traffickerId = (new \App\AdManager\UserManager())->getUserId();
Hi,
Thanks for this great resource.
Unfortunately, when I try to verify with this command: "php script/tests/ConnexionTest.php"
I get this error:
PHP Fatal error: Uncaught Error: Class 'Google\AdsApi\Dfp\DfpSessionBuilder' not found in /var/www/html/dfp-prebid-lineitems/app/Dfp/DfpManager.php:22 Stack trace: #0 /var/www/html/dfp-prebid-lineitems/script/tests/ConnexionTest.php(5): App\Dfp\DfpManager->__construct() #1 {main} thrown in /var/www/html/dfp-prebid-lineitems/app/Dfp/DfpManager.php on line 22
Any idea why?
Thanks!
Hi,
I followed all the instruction line by line. But still i am getting Permission denied error. Can you please guide me how can fix this error.
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Head
er>6cdd2f34ce98bc5c5d37046088b6f132465</responseT
ime></soap:Header>soap:Bodysoap:Faultsoap:Server
[PermissionError.PERMISSION_DENIED @ ][PermissionError.PERMISSION_DENIED @ ]<
/fieldPath>PermissionError.PERMISSION_DENIED</er
rorString>PERMISSION_DENIED</detai
l></soap:Fault></soap:Body></soap:Envelope>
Hello,
When I run php script/hb/HeaderBiddingCreationWithoutSSP.php i get the error CommonError.CANNOT_UPDATE @ lineItem[0].orderId;
My SOAP is below. Not sure what the issue might be. Do I ned to use an older API version?
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">soap:Headerda80f94b6231da57dffe324e0f021db6242</soap:Header>soap:Bodysoap:Faultsoap:Server[CommonError.CANNOT_UPDATE @ lineItem[0].orderId; trigger:'XXXXXXXXXX'][CommonError.CANNOT_UPDATE @ lineItem[0].orderId; trigger:'XXXXXXXXXX']lineItem[0].orderIdlineItem0orderIdXXXXXXXXXXCommonError.CANNOT_UPDATECANNOT_UPDATE</soap:Fault></soap:Body></soap:Envelope>
Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.