Skip to content

Commit

Permalink
Add two additional flight substitution variables
Browse files Browse the repository at this point in the history
  • Loading branch information
davidfischer committed Dec 2, 2024
1 parent 342d4c7 commit f85c290
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions adserver/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down
2 changes: 2 additions & 0 deletions adserver/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f85c290

Please sign in to comment.