Skip to content

Commit

Permalink
✨ ENHANCE: expand widgetOpts/logOpts (ampproject#39442)
Browse files Browse the repository at this point in the history
  • Loading branch information
powerivq authored and eszponder committed Apr 22, 2024
1 parent f137e21 commit 31f911c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
10 changes: 9 additions & 1 deletion ads/vendors/dable.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ export function dable(global, data) {
'setService',
data['serviceName'] || global.window.context.location.hostname
);
global.dable('setURL', global.window.context.sourceUrl);
global.dable(
'setURL',
global.window.context.canonicalUrl || global.window.context.sourceUrl
);
global.dable('setRef', global.window.context.referrer);

const slot = global.document.createElement('div');
Expand All @@ -34,6 +37,7 @@ export function dable(global, data) {
const articleSection = data['articleSection'] || '';
const articleSection2 = data['articleSection2'] || '';
const articleSection3 = data['articleSection3'] || '';
const orgServiceId = data['orgServiceId'] || '';
const widgetOpts = {};
const logOpts = {};

Expand All @@ -52,6 +56,10 @@ export function dable(global, data) {
widgetOpts.category3 = articleSection3;
logOpts.category3 = articleSection3;
}
if (orgServiceId) {
widgetOpts.orgServiceId = orgServiceId;
logOpts.orgServiceId = orgServiceId;
}

if (itemId) {
logOpts.id = itemId;
Expand Down
5 changes: 4 additions & 1 deletion ads/vendors/dable.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@
height="200"
type="dable"
data-widget-id="jobgqR7W"
data-service-name="testservice"
data-item-id="testitem"
data-article-section="politics"
data-article-section2="global"
data-org-service-id="1"
>
</amp-embed>
```
Expand All @@ -24,12 +26,13 @@ For configuration details and to generate your tags, please contact https://admi
### Required parameters

- `data-widget-id`
- `data-service-name`

### Optional parameters

- `data-item-id`
- `data-service-name`
- `data-channel`
- `data-article-section`
- `data-article-section2`
- `data-article-section3`
- `data-org-service-id`

0 comments on commit 31f911c

Please sign in to comment.