psammead-amp-geo -
Description
The psammead-amp-geo
component is an <amp-geo>
element to be used for AMP pages. It has a defined set of ISO country groups that we set for our privacy and cookie banners on AMP pages.
Installation
npm install @bbc/psammead-amp-geo
Props
Argument | Type | Required | Default | Example |
---|
No props. | | | | |
Usage
When using psammead-amp-geo
, you should firstly include this script in the head of the page:
<script
async
custom-element="amp-geo"
src="https://cdn.ampproject.org/v0/amp-geo-0.1.js"
/>
Then you can import the AmpGeo component & use it in conjunction with <amp-consent>
import AmpGeo from '@bbc/psammead-amp-geo';
const Wrapper = () => (
<>
<AmpGeo />
<amp-consent id="uniqueId" layout="nodisplay">
<script
type="application/json"
>
{
consents: {
'user-consent': {
promptIfUnknownForGeoGroup: 'eea',
promptUI: 'promptId',
},
},
}
</script>
</amp-consent>
</>
);
When to use this component
Use this component only on AMP pages when you need to have geo-location constrained to a specific list of countries in the EEA, also including Channel Islands and overseas territories.
Accessibility notes
The psammead-amp-geo
is an <amp-geo>
element.
Contributing
Psammead is completely open source. We are grateful for any contributions, whether they be new components, bug fixes or general improvements. Please see our primary contributing guide which can be found at the root of the Psammead respository.
We welcome feedback and help on this work. By participating in this project, you agree to abide by the code of conduct. Please take a moment to read it.
License
Psammead is Apache 2.0 licensed.