Why am I getting "Invalid GPT fixed size specification"

749 Views Asked by At

I'm getting:

Invalid GPT fixed size specification: [[[1024,0],[970,90]],[[768,0],[728,90]],[[330,0],[320,50]]]

My size mapping code looks like this:

window.googletag
  .sizeMapping()
  .addSize([1024, 0], [970, 90])
  .addSize([768, 0], [728, 90])
  .addSize([330, 0], [320, 50])
  .build()

Does anything look off?

1

There are 1 best solutions below

3
rabsom On

Your script specifies the following :

  • When viewport >= 1024px wide, ads sized 970x90 may serve.
  • When 1024px > viewport >= 768px, ads sized 728x90 may serve.
  • When 768px > viewport >= 330px, ads sized 330x50 may serve.

But what is happening for lower viewport width ? You need to cover all viewport sizes range, starting from 0x0 :

var mapping = googletag.sizeMapping()
.addSize([1024, 0], [970, 90])  
.addSize([768, 0], [728, 90])
.addSize([0, 0], [320, 50]) 
.build()

See here for official documentation.

EDIT : the error is about the fixed size, so when you define your slot, you just need to declare the possible creative sizes, not the associated viewport, and THEN apply the sizeMapping :

googletag.defineSlot('/yourAdPath/',[[970, 90], [728, 90], [320, 50]], 'targetId')
         .defineSizeMapping(mapping)
         .addService(googletag.pubads());

Detailed here