clickio

AMP floater example implementation

Jun 16th, 2026
14,657
0
Never
11
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 1. Paste this code in the <head> section of the AMP page:
  2.  
  3. Important: This code should only be added once. Ensure these elements are not already present before adding. In AMP, each library can only be included once, and duplicating the inclusion will result in an error, causing your AMP page to become invalid.
  4.  
  5. <script async src="https://cdn.ampproject.org/v0/amp-list-0.1.js" custom-element="amp-list"></script>
  6. <script async src="https://cdn.ampproject.org/v0/amp-bind-0.1.js" custom-element="amp-bind"></script>
  7. <script async src="https://cdn.ampproject.org/v0/amp-iframe-0.1.js" custom-element="amp-iframe"></script>
  8. <script async src="https://cdn.ampproject.org/v0/amp-mustache-0.2.js" custom-template="amp-mustache"></script>
  9.  
  10. 2. Insert the following CSS styles in your tag <style amp-custom> on the AMP page:
  11.  
  12. .cl_amp_floater{--scaleFactor:0.33;position:fixed;bottom:20px;right:20px;width:300px;height:calc(600px + 25px / var(--scaleFactor));margin:15px 15px 15px 15px;transform:scale(var(--scaleFactor));transform-origin:bottom right;z-index:2147483645}.cl_amp_floater *{box-sizing:border-box}#clickio-floater-list{width:1px;height:1px;overflow:visible}@media screen and (max-width:430px){.cl_amp_floater{right:10px;bottom:10px}}
  13.  
  14. 3. Add this code to the <body> of your AMP page:
  15.  
  16. <amp-state id="floatervisibilityState">
  17. <script type="application/json">
  18. {
  19. "clhidefloater": false
  20. }
  21. </script>
  22. </amp-state>
  23. <amp-list id="clickio-floater-list" class="clickio-floater-list" layout="fill" data-block-on-consent src="https://cns.clickiocdn.com/amp_360?source_url=SOURCE_URL&canonical_url=CANONICAL_URL&counter=COUNTER&document_referrer=DOCUMENT_REFERRER&viewer=VIEWER&scr_w=300&scr_h=676&scale=0.33&sid=XXXXXX&said=XXXXXX&btype=amp_floater">
  24. <template type="amp-mustache">
  25. <div class="cl_amp_floater">
  26. <amp-iframe data-block-on-consent resizable
  27. width="{{scr_w}}"
  28. height="{{scr_h}}"
  29. layout="responsive"
  30. id="clickio-floater-creative"
  31. frameborder="0"
  32. sandbox="allow-scripts allow-forms allow-same-origin allow-popups allow-popups-to-escape-sandbox allow-top-navigation allow-top-navigation-by-user-activation"
  33. src="{{_frame_src}}"
  34. on="message:AMP.setState({floatervisibilityState: {clhidefloater: true}})">
  35. <div placeholder></div>
  36. <div overflow></div>
  37. </amp-iframe>
  38. </div>
  39. </template>
  40. </amp-list>
Advertisement
Comments
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
Add Comment
Please, Sign In to add comment