Skip to main content

Nanga Ad Library

With Nanga, stay ahead of the competition, maximize your ROI, and build a more credible, effective advertising strategy !

Ad libraries are game-changer for advertisers, offering a wealth of strategic advantages:

  1. It allows you to track competitor campaigns in real-time, helping you understand which creatives, targeting strategies, and ad formats are driving results in your industry.
  2. By seeing detailed performance data like budgets, reach, and demographics, you can optimize your own ads with proven data-backed insights.

And today, Nanga Ad Library is gathering for you all Ad Libraries from the main social media platforms in one place !

Table of Contents

  1. Introduction
  2. Roadmap
  3. Usage
  4. Contributing
  5. License
  6. Acknowledgements

Introduction

The European regulation that requires social media platforms to make their advertising libraries publicly available is part of the Digital Services Act (DSA), which entered into force on August 25, 2023. This regulation is designed to enhance transparency and accountability across digital platforms. The DSA mandates that large platforms, such as social media networks and search engines, disclose their advertising practices, including providing access to data on the targeting of ads and the related algorithms.

The purpose of the DSA is to combat harmful content, enhance user safety, and ensure that platforms disclose details about how ads are shown, particularly those based on user profiles. These transparency requirements also aim to give researchers and the public access to this information, facilitating better oversight. Platforms such as Facebook, Google, and others with over 45 million active users are expected to follow these new rules, including publishing details about political ads, the algorithms used for targeting, and the effectiveness of these ads.

The regulations are enforced by the European Commission, and platforms that fail to comply face significant penalties, including fines of up to 6% of their global revenue.

Learn more about the Digital Services Act (DSA).

The DSA regulation forced the main social advertising platforms to provide public access to their ad library and the Nanga Ad Library is gathering them all for you.

Roadmap

New advertising platforms will soon be available in the Nanga Ad Library:

Installation

You can install this package directly from PyPI using pip:

pip install nanga-ad-library --upgrade
playwright install --with-deps

These commands will automatically download and install all required dependencies.

Usage

Prepare Ad Library for each platform

How to set up your Ad Library app ?

Use the package locally

Installation

You can install this package and all required dependencies directly from PyPI using pip:

pip install nanga-ad-library --upgrade

To be able to download ads elements, you'll have to download playwright browsers:

playwright install --with-deps

Extract data from Ad Library

Try to extract some results from the Nanga Ad Library API:

from nanga_ad_library import NangaAdLibrary

# Prepare the arguments to send to initiate the API
init_hash = {}

# Prepare connection hash depending on the platform to use (here is an example for Meta):
platform = "meta"
if platform == "meta":
    connection_hash = {
        "access_token": "{meta_access_token}"
    }
else:
    connection_hash = {}
init_hash.update(connection_hash)

# Prepare query hash (here is an example for Meta):
query_hash = {
    "payload": {
        "ad_active_status": "ACTIVE",
        "search_terms": "Facebook",
        "ad_reached_countries": ["FR"],
        "fields": [
            "id",
            "page_id",
            "ad_creation_time",
            "ad_delivery_start_time",
            "ad_delivery_stop_time",
            "ad_snapshot_url"
        ]
    }
}
init_hash.update(query_hash)

# Choose if ads elements will be downloaded (Title, Body, Description, Image or Video, Call to action).
# You can also provide download_start_date and download_end_date to retrieve ad_elements only for ads created 
# during this date range (both fields are optional).
download_hash = {
    "download_ads": True,
    "download_start_date": "2025-01-01",
    "download_end_date": "2025-01-25"
}
init_hash.update(download_hash)

# Initiating library
library = NangaAdLibrary.init(platform=platform, **init_hash)

# Extract the first results from the Ad Library API
results = library.get_results()

Note: please replace the {access_token} tag with valid tokens:

Deploy the package on the cloud

-- More to come

Use the package in a Jupyter Notebook

-- More to come

Contributing

Contributions are not yet available for members outside the Nanga project.

License

This project is licensed under the GNU general public License - see the LICENSE file for details.

Acknowledgements

Metadata

Release files for nanga-ad-library 1.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nanga-ad-library 1.2.1
File Size Uploaded Provenance Actions
nanga_ad_library-1.2.1.tar.gz 55.6 kB Without provenance Details for nanga_ad_library-1.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for nanga-ad-library 1.2.1
File Interpreter ABI Platform Actions
nanga_ad_library-1.2.1-py3-none-any.whl Python 3 none any Details for nanga_ad_library-1.2.1-py3-none-any.whl

Total release size: 110.4 kB

Release files / nanga_ad_library-1.2.1.tar.gz

Download URL nanga_ad_library-1.2.1.tar.gz
Size 55.6 kB
Tags Source
SHA-256 checksum
How to use checksums
ec2f666684b96d71858f6c999d31c402931774a3a43b188c96068b539eda9020
BLAKE2b-256 checksum
How to use checksums
37cd44175f7677ce8e7581f038e99c64996e080727cec49e629dd7805f931c5c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.6

Release files / nanga_ad_library-1.2.1-py3-none-any.whl

Download URL nanga_ad_library-1.2.1-py3-none-any.whl
Size 54.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
479dfea9abb1390ed9fda35ab7da10ecac0c27bcfab06b8659be3d35a30369a2
BLAKE2b-256 checksum
How to use checksums
f2268f4e722b677f5120b6ef4713f75c19ae1443dde5fddf684fa907de3bc9ed
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.6

Security for nanga-ad-library 1.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page