# Event-based ad requests

# Event-based ad requests

You can request ads based on events using the Google Publisher Tag library. In
the example below, a new ad is not requested or rendered until the user clicks a
button.

## Sample implementation

[View demo](https://googleads.github.io/google-publisher-tag-samples/event-based-requests/js/demo.html)

### JavaScript

## Loading...

<iframe id="builder" class="fixed-size" loading="lazy"></iframe>

## Loading...

[Improve this sample](https://github.com/googleads/google-publisher-tag-samples/tree/main/dist/event-based-requests/js) [Report an issue](https://github.com/googleads/google-publisher-tag-samples/issues/new?labels=documentation&template=sample-feedback.md&title=Sample+feedback:+event-based-requests/js)

### TypeScript

## Loading...

<iframe id="builder" class="fixed-size" loading="lazy"></iframe>

## Loading...

[Improve this sample](https://github.com/googleads/google-publisher-tag-samples/tree/main/dist/event-based-requests/ts) [Report an issue](https://github.com/googleads/google-publisher-tag-samples/issues/new?labels=documentation&template=sample-feedback.md&title=Sample+feedback:+event-based-requests/ts)