Module: dfp-responsive

A directive for giving an ad responsive sizes.

The dfp-responsive mapping is the angular-dfp pendant to GPT's sizeMapping and allows mapping viewport dimensions to ad sizes. More precisely, the dfp-responsive directive allows nesting one or more dfp-size tags, each specifying ad dimensions allowed for the given viewport width and height (and higher ones).

Using such mappings you can, for example, render 320x50 mobile leaderboards on smartphones and 728x90 leaderboards on desktops, all in the same ad slot.

The viewport height is optional and defaults to zero. It may not be required if you only care about viewport widths (phone, tablet, desktop screen sizes).

License:
  • Apache Copyright 2016 Google Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
See:

Example

Example usage of the `dfp-size` directive.

<dfp-ad ad-unit="path/to/my/ad-unit">
  <dfp-responsive viewport-width=320>
    <dfp-size width=300 height=50></dfp-size>
    <dfp-size width=320 height=50></dfp-size>
  </dfp-responsive>
  <dfp-responsive viewport-width=1024 viewport-height=800>
    <dfp-size width=970 height=90></dfp-size>
  </dfp-responsive>
</dfp-ad>