From f85c2901a1902eb1d1cd22ca2934640ea76c3f47 Mon Sep 17 00:00:00 2001 From: David Fischer Date: Mon, 2 Dec 2024 13:45:53 -0800 Subject: [PATCH] Add two additional flight substitution variables --- adserver/tests/test_api.py | 4 ++-- adserver/views.py | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/adserver/tests/test_api.py b/adserver/tests/test_api.py index 2825d97a..11b3f092 100644 --- a/adserver/tests/test_api.py +++ b/adserver/tests/test_api.py @@ -1790,7 +1790,7 @@ def test_view_tracking_ratelimit(self): self.assertEqual(resp["X-Adserver-Reason"], "Ratelimited view impression") def test_click_tracking_variable_expansion(self): - self.ad.link = "http://example.com?utm_source=${publisher}" + self.ad.link = "http://example.com?utm_source=${publisher}&ad=${advertisement}" self.ad.save() Offer.objects.filter(id=self.offer["nonce"]).update(viewed=True) @@ -1799,7 +1799,7 @@ def test_click_tracking_variable_expansion(self): self.assertEqual(resp.status_code, 302) self.assertEqual( resp["Location"], - "http://example.com?utm_source=test-publisher&ea-publisher=test-publisher", + "http://example.com?utm_source=test-publisher&ad=ad-slug&ea-publisher=test-publisher", ) # invalid string replacement template diff --git a/adserver/views.py b/adserver/views.py index bef9bc84..9b8b1903 100644 --- a/adserver/views.py +++ b/adserver/views.py @@ -1208,6 +1208,8 @@ def get_response(self, request, advertisement, publisher): advertisement_slug=advertisement.slug, advertisement_name=advertisement.name, flight=advertisement.flight.slug, + flight_slug=advertisement.flight.slug, + flight_name=advertisement.flight.name, # For privacy, don't reveal more than country/continent to advertisers country=str(request.geo.country) if request.geo else "None", # request.geo.region is a state/province/region inside a country