### Install Dependencies with Composer Source: https://github.com/googleads/googleads-displayvideo-examples/blob/main/php/v4/README.md Run this command in the example directory to install all project dependencies. ```bash composer install ``` -------------------------------- ### Install Dependencies Source: https://github.com/googleads/googleads-displayvideo-examples/blob/main/python/README.md Installs all necessary Python dependencies for the samples. Ensure you are running Python 3.8 or higher. ```Batchfile $ python -m pip install -r requirements.txt ``` -------------------------------- ### Run a Display & Video 360 API Example Source: https://github.com/googleads/googleads-displayvideo-examples/blob/main/python/README.md Executes a Python sample for the Display & Video 360 API. Replace placeholders with your specific IDs and names. This command initiates the authorization flow in your browser. ```Python python create_campaign.py ``` -------------------------------- ### Run Local Development Server Source: https://github.com/googleads/googleads-displayvideo-examples/blob/main/php/v4/README.md Execute this command in the project directory to start a local PHP development server. ```bash php -S localhost:8000 -t ./ ``` -------------------------------- ### Clone the Repository Source: https://github.com/googleads/googleads-displayvideo-examples/blob/main/java/v4/README.md Use this command to download the sample code from the GitHub repository. ```bash git clone https://github.com/googleads/googleads-displayvideo-examples ``` -------------------------------- ### Run ListBrowserTargetingOptions with Maven Source: https://github.com/googleads/googleads-displayvideo-examples/blob/main/java/v4/README.md This command executes the ListBrowserTargetingOptions Java sample using Maven. Replace INSERT_ADVERTISER_ID_HERE with your actual advertiser ID. ```bash $ mvn exec:java -Dexec.mainClass="com.google.displayvideo.api.samples.ListBrowserTargetingOptions" -Dexec.args="--advertiserId INSERT_ADVERTISER_ID_HERE" ``` -------------------------------- ### Compile with Maven Source: https://github.com/googleads/googleads-displayvideo-examples/blob/main/java/v4/README.md Execute this command to compile the Java project using Maven. ```bash $ mvn compile ``` -------------------------------- ### Upload Custom Bidding Script in Python Source: https://context7.com/googleads/googleads-displayvideo-examples/llms.txt Uploads a custom bidding algorithm script by creating a reference, uploading the media, and finalizing the script object. Requires the google-api-python-client library. ```python from apiclient.http import MediaFileUpload, HttpRequest from googleapiclient.errors import HttpError def upload_custom_bidding_script(service, advertiser_id, algorithm_id, script_path): """Uploads a custom bidding script file under a given algorithm resource.""" try: # Get a script reference script_ref = ( service.customBiddingAlgorithms() .uploadScript( customBiddingAlgorithmId=algorithm_id, advertiserId=advertiser_id, ) .execute() ) print(f"Script reference created: {script_ref}") # Upload the script file media = MediaFileUpload(script_path) upload_request = service.media().upload( resourceName=script_ref["resourceName"], media_body=media ) upload_request.postproc = HttpRequest.null_postproc upload_request.execute() # Create the script object script_obj = {"script": script_ref} script = ( service.customBiddingAlgorithms() .scripts() .create( customBiddingAlgorithmId=algorithm_id, advertiserId=advertiser_id, body=script_obj, ) .execute() ) print(f"Custom bidding script created: {script}") return script except HttpError as e: print(f"Error uploading custom bidding script: {e}") raise # Usage # python upload_custom_bidding_script.py 123456 789012 ./bidding_script.js script = upload_custom_bidding_script( service, advertiser_id="123456", algorithm_id="789012", script_path="./bidding_script.js" ) # Output: # Script reference created: {'resourceName': 'customBiddingAlgorithms/789012/scriptRef/abc123'} # Custom bidding script created: {'name': 'customBiddingAlgorithms/789012/scripts/456789', ...} ``` -------------------------------- ### List Browser Targeting Options Source: https://context7.com/googleads/googleads-displayvideo-examples/llms.txt Retrieves available browser targeting options for an advertiser using pagination. ```python from googleapiclient.errors import HttpError def list_browser_targeting_options(service, advertiser_id): """Lists all available browser targeting options.""" next_page_token = "" all_options = [] try: while True: response = ( service.targetingTypes() .targetingOptions() .list( advertiserId=advertiser_id, targetingType="TARGETING_TYPE_BROWSER", pageToken=next_page_token, ) .execute() ) if response: for option in response.get("targetingOptions", []): print( f"Targeting Option ID: {option['targetingOptionId']}, " f"Browser Display Name: {option['browserDetails']['displayName']}" ) all_options.append(option) else: print("List request returned no Targeting Options.") break if "nextPageToken" in response: next_page_token = response["nextPageToken"] else: break return all_options except HttpError as e: print(f"Error listing targeting options: {e}") raise # Command line: python list_browser_targeting_options.py ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.