amphtml icon indicating copy to clipboard operation
amphtml copied to clipboard

Add ViewportWidth/Height variables for AMP Analytics

Open j-e-shaw opened this issue 10 years ago • 8 comments

With more devices supporting split-screen (Android N provides it), the screen dimensions aren't as useful. Having the actual browser viewport dimensions available in analytics would better for viewability and verification purposes.

j-e-shaw avatar Aug 19 '16 20:08 j-e-shaw

/to @avimehta

dvoytenko avatar Aug 19 '16 22:08 dvoytenko

Do availableScreenHeight and availableScreenWidth cover this request (https://github.com/ampproject/amphtml/blob/master/extensions/amp-analytics/analytics-vars.md#device-and-browser)?

rudygalfi avatar Aug 20 '16 17:08 rudygalfi

Aren't those just the size of the screen minus the toolbars?

If the browser is running split-screen on a mobile device, the screen dimensions shouldn't be changing but the viewport size of the browser would be smaller.

j-e-shaw avatar Aug 23 '16 23:08 j-e-shaw

Yes, viewport metrics should definitely be used for something like this. My quick search points to VIEWPORT_HEIGHT and VIEWPORT_WIDTH vars in https://github.com/ampproject/amphtml/blob/master/spec/amp-var-substitutions.md#viewport_height

This is what you want, right?

dvoytenko avatar Aug 25 '16 14:08 dvoytenko

Ah, yes, somehow I missed those. Do the variables @dvoytenko mentioned work?

rudygalfi avatar Aug 25 '16 18:08 rudygalfi

Yes, it looks like those should work. Are they currently available for analytics?

Thanks!

j-e-shaw avatar Aug 30 '16 16:08 j-e-shaw

@j-e-shaw Yes. As ${viewportHeight} and ${viewportWidth} vars.

dvoytenko avatar Aug 30 '16 16:08 dvoytenko

I'll close this at this time. But please re-open if needed.

dvoytenko avatar Aug 30 '16 16:08 dvoytenko