django.conf.settings.ADSERVER_DO_NOT_TRACK

Here are the examples of the python api django.conf.settings.ADSERVER_DO_NOT_TRACK taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

3 Examples 7

3 Source : views.py
with GNU Affero General Public License v3.0
from readthedocs

def do_not_track_policy(request):
    """
    Returns the Do Not Track policy.

    https://github.com/EFForg/dnt-guide#12-how-to-assert-dnt-compliance

    :raises: Http404 if ``settings.ADSERVER_DO_NOT_TRACK`` is ``False``
    """
    if not settings.ADSERVER_DO_NOT_TRACK:
        raise Http404

    return render(request, "adserver/dnt-policy.txt", content_type="text/plain")


@login_required

0 Source : models.py
with GNU Affero General Public License v3.0
from readthedocs

    def _record_base(
        self, request, model, publisher, keywords, url, div_id, ad_type_slug
    ):
        """
        Save the actual AdBase model to the database.

        This is used for all subclasses,
        so we need to keep all the data passed in generic.
        """
        ip_address = get_client_ip(request)
        user_agent = get_client_user_agent(request)
        client_id = get_client_id(request)
        parsed_ua = parse(user_agent)
        country = get_client_country(request)
        url = url or request.META.get("HTTP_REFERER")

        if model != Click and settings.ADSERVER_DO_NOT_TRACK:
            # For compliance with DNT,
            # we can't store UAs indefinitely from a user merely browsing
            user_agent = None

        if div_id:
            # Even though the publisher could have a div of any length
            # and we want to echo back the same div to them,
            # we only store the first 100 characters of it.
            div_id = div_id[: Offer.DIV_MAXLENGTH]

        obj = model.objects.create(
            date=timezone.now(),
            publisher=publisher,
            ip=anonymize_ip_address(ip_address),
            user_agent=user_agent,
            client_id=client_id,
            country=country,
            url=url,
            # Derived user agent data
            browser_family=parsed_ua.browser.family,
            os_family=parsed_ua.os.family,
            is_bot=parsed_ua.is_bot,
            is_mobile=parsed_ua.is_mobile,
            # Client Data
            keywords=keywords if keywords else None,  # Don't save empty lists
            div_id=div_id,
            ad_type_slug=ad_type_slug,
            # Page info
            advertisement=self,
        )
        return obj

    def track_impression(self, request, impression_type, publisher, offer):

0 Source : views.py
with GNU Affero General Public License v3.0
from readthedocs

def do_not_track(request):
    """
    Returns the Do Not Track status for the user.

    https://w3c.github.io/dnt/drafts/tracking-dnt.html#status-representation

    :raises: Http404 if ``settings.ADSERVER_DO_NOT_TRACK`` is ``False``
    """
    if not settings.ADSERVER_DO_NOT_TRACK:
        raise Http404

    dnt_header = request.META.get("HTTP_DNT")

    data = {"tracking": "N" if dnt_header == "1" else "T"}
    if settings.ADSERVER_PRIVACY_POLICY_URL:
        data["policy"] = settings.ADSERVER_PRIVACY_POLICY_URL

    # pylint: disable=redundant-content-type-for-json-response
    return JsonResponse(data, content_type="application/tracking-status+json")


def do_not_track_policy(request):