diff --git a/data/arabic/legacyAssets/worldnews/2015/11/151120_t_arabic_av.json b/data/arabic/legacyAssets/worldnews/2015/11/151120_t_arabic_av.json
index d31adc3ee23..189f4b83fa1 100644
--- a/data/arabic/legacyAssets/worldnews/2015/11/151120_t_arabic_av.json
+++ b/data/arabic/legacyAssets/worldnews/2015/11/151120_t_arabic_av.json
@@ -28,7 +28,8 @@
"analyticsLabels": {
"cps_asset_type": "map",
"cps_asset_id": "17694217",
- "contentId": "urn:bbc:topcat:curie:asset:22d6ef3c-8f6e-11e5-b707-b2517c19ac20"
+ "contentId": "urn:bbc:topcat:curie:asset:22d6ef3c-8f6e-11e5-b707-b2517c19ac20",
+ "page": "arabic.worldnews.2015.11.151120_t_arabic_av.page"
},
"passport": {
"home": "http://www.bbc.co.uk/ontologies/passport/home/Arabic",
@@ -41,7 +42,20 @@
"paragraph"
],
"includeComments": false,
- "atiAnalytics": {},
+ "atiAnalytics": {
+ "campaigns": null,
+ "categoryName": null,
+ "contentId": "urn:bbc:topcat:curie:asset:22d6ef3c-8f6e-11e5-b707-b2517c19ac20",
+ "contentType": "article-media-asset",
+ "language": "ar",
+ "ldpThingIds": null,
+ "ldpThingLabels": null,
+ "pageIdentifier": "worldnews::arabic.worldnews.2015.11.151120_t_arabic_av.page",
+ "pageTitle": "شركة شارب للإلكترونيات تحث موظفيها على شراء منتجاتها",
+ "producerId": null,
+ "timePublished": "2015-11-20T10:09:33.000Z",
+ "timeUpdated": "2015-11-20T10:09:33.000Z"
+ },
"readTime": 1,
"siteUri": "/arabic",
"mediaType": "video",
diff --git a/data/gahuza/cpsAssets/23313911.json b/data/gahuza/cpsAssets/23313911.json
index 925beae44ac..d9e53ad12e8 100644
--- a/data/gahuza/cpsAssets/23313911.json
+++ b/data/gahuza/cpsAssets/23313911.json
@@ -53,8 +53,19 @@
],
"includeComments": false,
"atiAnalytics": {
- "producerName": "GAHUZA",
- "producerId": "40"
+ "campaigns": null,
+ "categoryName": null,
+ "contentId": "urn:bbc:cps:curie:asset:48fe44a1-f432-4475-942d-ab017d13b4d0",
+ "contentType": "article",
+ "language": "rw",
+ "ldpThingIds": null,
+ "ldpThingLabels": null,
+ "pageIdentifier": "gahuza.story.23313911.page",
+ "pageTitle": "Test story with different IDT2 typess",
+ "producerId": null,
+ "timePublished": "2020-06-09T16:26:57.000Z",
+ "timeUpdated": "2020-06-09T17:09:42.000Z",
+ "producerName": "GAHUZA"
},
"readTime": 1,
"siteUri": "/gahuza"
diff --git a/data/kyrgyz/cpsAssets/23292889.json b/data/kyrgyz/cpsAssets/23292889.json
index b5d0478706c..ca1e54e85f7 100644
--- a/data/kyrgyz/cpsAssets/23292889.json
+++ b/data/kyrgyz/cpsAssets/23292889.json
@@ -53,8 +53,19 @@
],
"includeComments": false,
"atiAnalytics": {
- "producerName": "KYRGYZ",
- "producerId": "58"
+ "campaigns": null,
+ "categoryName": null,
+ "contentId": "urn:bbc:cps:curie:asset:bb9390aa-4b35-e448-b295-cbd7369fe457",
+ "contentType": "article",
+ "language": "ky",
+ "ldpThingIds": null,
+ "ldpThingLabels": null,
+ "pageIdentifier": "kyrgyz.story.23292889.page",
+ "pageTitle": "Test STY for social embeds",
+ "producerId": null,
+ "timePublished": "2020-04-24T14:51:17.000Z",
+ "timeUpdated": "2020-04-24T14:51:17.000Z",
+ "producerName": "KYRGYZ"
},
"readTime": 1,
"siteUri": "/kyrgyz",
diff --git a/data/mundo/cpsAssets/deportes-36935058.json b/data/mundo/cpsAssets/deportes-36935058.json
index 604b3f42355..9e5364cfd7c 100644
--- a/data/mundo/cpsAssets/deportes-36935058.json
+++ b/data/mundo/cpsAssets/deportes-36935058.json
@@ -49,8 +49,19 @@
],
"includeComments": false,
"atiAnalytics": {
- "producerName": "MUNDO",
- "producerId": "62"
+ "campaigns": null,
+ "categoryName": null,
+ "contentId": "urn:bbc:cps:curie:asset:08e22e90-7361-cd47-b586-7cb53fc5a012",
+ "contentType": "article-photo-gallery",
+ "language": "es",
+ "ldpThingIds": null,
+ "ldpThingLabels": null,
+ "pageIdentifier": "sport::mundo.sport.photo_gallery.36935058.page",
+ "pageTitle": "Río 2016, el antes y el ahora: cómo ha cambiado la ropa deportiva en más de un siglo de juegos olímpicos",
+ "producerId": null,
+ "timePublished": "2016-08-07T09:21:02.000Z",
+ "timeUpdated": "2016-08-07T09:21:02.000Z",
+ "producerName": "MUNDO"
},
"readTime": 2,
"siteUri": "/mundo",
diff --git a/data/mundo/cpsAssets/noticias-internacional-51266689.json b/data/mundo/cpsAssets/noticias-internacional-51266689.json
index 3e631ce7865..5b1ece2ac22 100644
--- a/data/mundo/cpsAssets/noticias-internacional-51266689.json
+++ b/data/mundo/cpsAssets/noticias-internacional-51266689.json
@@ -64,8 +64,24 @@
],
"includeComments": false,
"atiAnalytics": {
- "producerName": "MUNDO",
- "producerId": "62"
+ "campaigns": [
+ {
+ "campaignId": "5a988e3739461b000e9dabfa",
+ "campaignName": "WS - Give me perspective"
+ }
+ ],
+ "categoryName": "Explainer",
+ "contentId": "urn:bbc:cps:curie:asset:faf2993a-dcc0-0746-81a6-a6aca4cd59b1",
+ "contentType": "article",
+ "language": "es",
+ "ldpThingIds": null,
+ "ldpThingLabels": null,
+ "pageIdentifier": "world::mundo.world.story.51266689.page",
+ "pageTitle": "Brexit: qué cambiará para visitar, trabajar y estudiar en Reino Unido tras la salida del país de la Unión Europea",
+ "producerId": null,
+ "timePublished": "2020-01-30T06:35:49.000Z",
+ "timeUpdated": "2020-01-30T06:35:49.000Z",
+ "producerName": "MUNDO"
},
"readTime": 8,
"siteUri": "/mundo",
diff --git a/data/news/articles/c0g992jmmkko.json b/data/news/articles/c0g992jmmkko.json
index 9de93203baa..325e59cbaa0 100644
--- a/data/news/articles/c0g992jmmkko.json
+++ b/data/news/articles/c0g992jmmkko.json
@@ -895,11 +895,12 @@
"metadata": {
"id": "urn:bbc:ares::article:c0g992jmmkko",
"atiAnalytics": {
- "categoryName": "Wedding%20of%20Prince%20Harry%20and%20Meghan%20Markle~Duchess%20of%20Sussex~Hackney~Windsor",
+ "categoryName": "Wedding+of+Prince+Harry+and+Meghan+Markle~Duchess+of+Sussex~Hackney~Windsor",
"contentId": "urn:bbc:optimo:asset:c0g992jmmkko",
+ "contentType": "article",
"language": "en-gb",
"ldpThingIds": "2351f2b2-ce36-4f44-996d-c3c4f7f90eaa~803eaeb9-c0c3-4f1b-9a66-90efac3df2dc~dba7dfeb-87d3-4801-80ba-fa8be6c9555e~f94940f0-476c-4ec7-b48d-e58120bb1956",
- "ldpThingLabels": "Wedding%20of%20Prince%20Harry%20and%20Meghan%20Markle~Duchess%20of%20Sussex~Hackney~Windsor",
+ "ldpThingLabels": "Wedding+of+Prince+Harry+and+Meghan+Markle~Duchess+of+Sussex~Hackney~Windsor",
"nationsProducer": null,
"pageIdentifier": "news.articles.c0g992jmmkko.page",
"pageTitle": "Royal wedding flowers given to Hackney hospice",
diff --git a/data/persian/articles/c4vlle3q337o.json b/data/persian/articles/c4vlle3q337o.json
index e9e715496a2..767f03134a7 100644
--- a/data/persian/articles/c4vlle3q337o.json
+++ b/data/persian/articles/c4vlle3q337o.json
@@ -528,6 +528,7 @@
"atiAnalytics": {
"categoryName": null,
"contentId": "urn:bbc:optimo:asset:c4vlle3q337o",
+ "contentType": "article",
"language": "fa",
"ldpThingIds": null,
"ldpThingLabels": null,
diff --git a/data/persian/cpsAssets/iran-23231114.json b/data/persian/cpsAssets/iran-23231114.json
index 7b3367ec981..c249b1771a5 100644
--- a/data/persian/cpsAssets/iran-23231114.json
+++ b/data/persian/cpsAssets/iran-23231114.json
@@ -47,8 +47,19 @@
],
"includeComments": false,
"atiAnalytics": {
- "producerName": "PERSIAN",
- "producerId": "69"
+ "campaigns": null,
+ "categoryName": null,
+ "contentId": "urn:bbc:cps:curie:asset:43667729-4c50-834f-a4b5-c0c95c3cafcf",
+ "contentType": "article-media-asset",
+ "language": "fa",
+ "ldpThingIds": null,
+ "ldpThingLabels": null,
+ "pageIdentifier": "iran::persian.iran.media_asset.23231114.page",
+ "pageTitle": "Trump long headline",
+ "producerId": null,
+ "timePublished": "2019-02-15T12:47:51.000Z",
+ "timeUpdated": "2019-02-15T12:47:51.000Z",
+ "producerName": "PERSIAN"
},
"siteUri": "/persian",
"mediaType": "audio",
diff --git a/data/pidgin/cpsAssets/23248703.json b/data/pidgin/cpsAssets/23248703.json
index 47456524ca1..cbdd6b2c622 100644
--- a/data/pidgin/cpsAssets/23248703.json
+++ b/data/pidgin/cpsAssets/23248703.json
@@ -117,8 +117,32 @@
],
"includeComments": false,
"atiAnalytics": {
- "producerName": "PIDGIN",
- "producerId": "70"
+ "campaigns": [
+ {
+ "campaignId": "5ad8625ac93a9f000eecb253",
+ "campaignName": "Inspire me"
+ },
+ {
+ "campaignId": "5ad86285c93a9f000eecb256",
+ "campaignName": "Give me perspective"
+ },
+ {
+ "campaignId": "5ad86291c93a9f000eecb257",
+ "campaignName": "Keep me on trend"
+ }
+ ],
+ "categoryName": "Opinion",
+ "contentId": "urn:bbc:cps:curie:asset:5679389a-3ea6-0b40-9de4-f4d33d6bcd9f",
+ "contentType": "article-media-asset",
+ "language": "pcm",
+ "ldpThingIds": null,
+ "ldpThingLabels": null,
+ "pageIdentifier": "pidgin.media_asset.23248703.page",
+ "pageTitle": "DO NOT EDIT THIS IS AN AUTOMATED TEST dolor sit amet, consectetur Lorem 'ipsum' dolor sit amet, consectetur Lorem ipsum dolor sitamet, consectetur",
+ "producerId": null,
+ "timePublished": "2019-09-13T15:31:44.000Z",
+ "timeUpdated": "2020-06-10T14:24:07.000Z",
+ "producerName": "PIDGIN"
},
"readTime": 1,
"siteUri": "/pidgin",
diff --git a/data/pidgin/cpsAssets/world-23252817.json b/data/pidgin/cpsAssets/world-23252817.json
index 8c07704082a..46b20952ffa 100644
--- a/data/pidgin/cpsAssets/world-23252817.json
+++ b/data/pidgin/cpsAssets/world-23252817.json
@@ -65,8 +65,24 @@
],
"includeComments": false,
"atiAnalytics": {
- "producerName": "PIDGIN",
- "producerId": "70"
+ "campaigns": [
+ {
+ "campaignId": "5ad86265c93a9f000eecb254",
+ "campaignName": "Educate me"
+ }
+ ],
+ "categoryName": "News",
+ "contentId": "urn:bbc:cps:curie:asset:740a2911-be7a-d945-a968-d812272c2147",
+ "contentType": "article",
+ "language": "pcm",
+ "ldpThingIds": null,
+ "ldpThingLabels": null,
+ "pageIdentifier": "world::pidgin.world.story.23252817.page",
+ "pageTitle": "STY - Blood pressure drugs dey work better",
+ "producerId": null,
+ "timePublished": "2019-10-23T12:39:30.000Z",
+ "timeUpdated": "2019-10-23T12:39:30.000Z",
+ "producerName": "PIDGIN"
},
"readTime": 2,
"siteUri": "/pidgin"
diff --git a/data/scotland/articles/czwj5l0n210o.json b/data/scotland/articles/czwj5l0n210o.json
index edc0eaf3b24..2c5a555a375 100644
--- a/data/scotland/articles/czwj5l0n210o.json
+++ b/data/scotland/articles/czwj5l0n210o.json
@@ -695,6 +695,7 @@
"atiAnalytics": {
"categoryName": null,
"contentId": "urn:bbc:optimo:asset:czwj5l0n210o",
+ "contentType": "article",
"language": "en-gb",
"ldpThingIds": null,
"ldpThingLabels": null,
diff --git a/data/ukrainian/cpsAssets/features-russian-53477115.json b/data/ukrainian/cpsAssets/features-russian-53477115.json
index 34dfb24131d..f7f2d3f6a1a 100644
--- a/data/ukrainian/cpsAssets/features-russian-53477115.json
+++ b/data/ukrainian/cpsAssets/features-russian-53477115.json
@@ -2718,13 +2718,31 @@
},
"metadata":{
"analyticsLabels":{
+ "ldp_ids": "5307a8d9-f620-40f5-92d4-f99c919a6ffa~75612fa6-147c-4a43-97fa-fcf70d9cced3~ee8750ed-a7fb-453f-bfca-2aa8b3fb064c",
+ "ldp_tags": "Society~Politics~Ukraine",
"counterName":"ukrainian.russian_features.story.53477115.page",
"cps_asset_id":"53477115",
"cps_asset_type":"sty"
},
- "atiAnalytics":{
- "producerId":"94",
- "producerName":"UKRAINIAN"
+ "atiAnalytics": {
+ "campaigns": [
+ {
+ "campaignId": "5a988e4739461b000e9dabfc",
+ "campaignName": "WS - Update me"
+ }
+ ],
+ "categoryName": "News",
+ "contentId": "urn:bbc:cps:curie:asset:307108d3-9bcc-4829-990c-4b42c1290258",
+ "contentType": "article",
+ "language": "ru",
+ "ldpThingLabels": "Society~Politics~Ukraine",
+ "ldpThingIds": "5307a8d9-f620-40f5-92d4-f99c919a6ffa~75612fa6-147c-4a43-97fa-fcf70d9cced3~ee8750ed-a7fb-453f-bfca-2aa8b3fb064c",
+ "pageIdentifier": "russian_features::ukrainian.russian_features.story.53477115.page",
+ "pageTitle": "Карта новых районов Украины: кто и кого поглотил",
+ "producerId": null,
+ "timePublished": "2020-07-21T13:00:09.000Z",
+ "timeUpdated": "2020-07-21T13:00:09.000Z",
+ "producerName": "UKRAINIAN"
},
"blockTypes":[
"image",
diff --git a/data/ukrainian/cpsAssets/news-53561143.json b/data/ukrainian/cpsAssets/news-53561143.json
index 86d7dbc057b..70f15c65244 100644
--- a/data/ukrainian/cpsAssets/news-53561143.json
+++ b/data/ukrainian/cpsAssets/news-53561143.json
@@ -77,161 +77,154 @@
]
},
"metadata":{
- "analyticsLabels":{
- "counterName":"ukrainian.news.story.53561143.page",
- "cps_asset_id":"53561143",
- "cps_asset_type":"sty"
+ "analyticsLabels": {
+ "ldp_ids": "1a5696c5-07d0-4a08-8b54-41ad5cd534b6~37cd3473-7b24-44b0-84c1-bf3c4801df5e~4b4cca1c-d458-4310-819e-dd48572b12c4~ee8750ed-a7fb-453f-bfca-2aa8b3fb064c",
+ "ldp_tags": "Afghanistan~Drug+use~Drugs+trade~Ukraine",
+ "counterName": "ukrainian.news.story.53561143.page",
+ "cps_asset_id": "53561143",
+ "cps_asset_type": "sty"
},
- "atiAnalytics":{
- "producerId":"94",
- "producerName":"UKRAINIAN"
+ "atiAnalytics": {
+ "campaigns": [
+ {
+ "campaignId": "5a988e2939461b000e9dabf8",
+ "campaignName": "WS - Educate me"
+ }
+ ],
+ "categoryName": "News",
+ "contentId": "urn:bbc:cps:curie:asset:9e539daf-1d79-4630-900c-7db33c4bf1ac",
+ "contentType": "article",
+ "language": "uk",
+ "ldpThingIds": "1a5696c5-07d0-4a08-8b54-41ad5cd534b6~37cd3473-7b24-44b0-84c1-bf3c4801df5e~4b4cca1c-d458-4310-819e-dd48572b12c4~ee8750ed-a7fb-453f-bfca-2aa8b3fb064c",
+ "ldpThingLabels": "Afghanistan~Drug+use~Drugs+trade~Ukraine",
+ "pageIdentifier": "news::ukrainian.news.story.53561143.page",
+ "pageTitle": "Виробництво героїну зросло завдяки сонячним батареям. Погляд з Британії",
+ "producerId": null,
+ "timePublished": "2020-07-28T13:25:13.000Z",
+ "timeUpdated": "2020-07-28T13:25:13.000Z",
+ "producerName": "UKRAINIAN"
},
- "blockTypes":[
- "social_embed",
- "paragraph"
- ],
- "createdBy":"ukrainian-v6",
- "firstPublished":1595942713000,
- "id":"urn:bbc:ares::asset:ukrainian/news-53561143",
- "includeComments":false,
- "language":"uk",
- "lastPublished":1595942713000,
- "lastUpdated":1595945068228,
- "locators":{
- "assetId":"53561143",
- "assetUri":"/ukrainian/news-53561143",
- "cpsUrn":"urn:bbc:content:assetUri:ukrainian/news-53561143",
- "curie":"http://www.bbc.co.uk/asset/9e539daf-1d79-4630-900c-7db33c4bf1ac"
+ "blockTypes": ["social_embed", "paragraph"],
+ "createdBy": "ukrainian-v6",
+ "firstPublished": 1595942713000,
+ "id": "urn:bbc:ares::asset:ukrainian/news-53561143",
+ "includeComments": false,
+ "language": "uk",
+ "lastPublished": 1595942713000,
+ "lastUpdated": 1595945068228,
+ "locators": {
+ "assetId": "53561143",
+ "assetUri": "/ukrainian/news-53561143",
+ "cpsUrn": "urn:bbc:content:assetUri:ukrainian/news-53561143",
+ "curie": "http://www.bbc.co.uk/asset/9e539daf-1d79-4630-900c-7db33c4bf1ac"
},
- "options":{
- "allowAdvertising":true,
- "allowDateStamp":true,
- "allowHeadline":true,
- "allowPrintingSharingLinks":true,
- "allowRelatedStoriesBox":true,
- "allowRightHandSide":true,
- "hasContentWarning":false,
- "hasNewsTracker":false,
- "includeComments":false,
- "isBreakingNews":false,
- "isFactCheck":false,
- "isIgorSeoTagsEnabled":false,
- "isKeyContent":false,
- "suitableForSyndication":true
+ "options": {
+ "allowAdvertising": true,
+ "allowDateStamp": true,
+ "allowHeadline": true,
+ "allowPrintingSharingLinks": true,
+ "allowRelatedStoriesBox": true,
+ "allowRightHandSide": true,
+ "hasContentWarning": false,
+ "hasNewsTracker": false,
+ "includeComments": false,
+ "isBreakingNews": false,
+ "isFactCheck": false,
+ "isIgorSeoTagsEnabled": false,
+ "isKeyContent": false,
+ "suitableForSyndication": true
},
- "passport":{
- "campaigns":[
+ "passport": {
+ "campaigns": [
{
- "campaignId":"5a988e2939461b000e9dabf8",
- "campaignName":"WS - Educate me"
+ "campaignId": "5a988e2939461b000e9dabf8",
+ "campaignName": "WS - Educate me"
}
],
- "category":{
- "categoryId":"http://www.bbc.co.uk/ontologies/applicationlogic-news/News",
- "categoryName":"News"
+ "category": {
+ "categoryId": "http://www.bbc.co.uk/ontologies/applicationlogic-news/News",
+ "categoryName": "News"
},
- "taggings":[
-
- ]
+ "taggings": []
},
- "tags":{
- "about":[
+ "tags": {
+ "about": [
{
- "curationList":[
+ "curationList": [
{
- "curationId":"0a7394f6-125d-4892-a338-43d66113ec07",
- "curationType":"vivo-stream"
+ "curationId": "0a7394f6-125d-4892-a338-43d66113ec07",
+ "curationType": "vivo-stream"
}
],
- "thingEnglishLabel":"Afghanistan",
- "thingId":"1a5696c5-07d0-4a08-8b54-41ad5cd534b6",
- "thingLabel":"Афганістан",
- "thingSameAs":[
- "http://sws.geonames.org/1149361/"
- ],
- "thingType":[
- "tagging:TagConcept",
- "core:Place",
- "core:Thing"
- ],
- "thingUri":"http://www.bbc.co.uk/things/1a5696c5-07d0-4a08-8b54-41ad5cd534b6#id",
- "topicId":"cvjp20q59z6t",
- "topicName":"Афганістан"
+ "thingEnglishLabel": "Afghanistan",
+ "thingId": "1a5696c5-07d0-4a08-8b54-41ad5cd534b6",
+ "thingLabel": "Афганістан",
+ "thingSameAs": ["http://sws.geonames.org/1149361/"],
+ "thingType": ["tagging:TagConcept", "core:Place", "core:Thing"],
+ "thingUri": "http://www.bbc.co.uk/things/1a5696c5-07d0-4a08-8b54-41ad5cd534b6#id",
+ "topicId": "cvjp20q59z6t",
+ "topicName": "Афганістан"
},
{
- "curationList":[
+ "curationList": [
{
- "curationId":"5238251a-289b-4711-b859-41b9a01f87d8",
- "curationType":"vivo-stream"
+ "curationId": "5238251a-289b-4711-b859-41b9a01f87d8",
+ "curationType": "vivo-stream"
}
],
- "thingEnglishLabel":"Drug use",
- "thingId":"37cd3473-7b24-44b0-84c1-bf3c4801df5e",
- "thingLabel":"Вживання наркотиків",
- "thingSameAs":[
+ "thingEnglishLabel": "Drug use",
+ "thingId": "37cd3473-7b24-44b0-84c1-bf3c4801df5e",
+ "thingLabel": "Вживання наркотиків",
+ "thingSameAs": [
"http://www.wikidata.org/entity/Q7708739",
"http://dbpedia.org/resource/Recreational_drug_use"
],
- "thingType":[
- "tagging:TagConcept",
- "core:Theme",
- "core:Thing"
- ],
- "thingUri":"http://www.bbc.co.uk/things/37cd3473-7b24-44b0-84c1-bf3c4801df5e#id",
- "topicId":"cwr9j9xxrxxt",
- "topicName":"Вживання наркотиків"
+ "thingType": ["tagging:TagConcept", "core:Theme", "core:Thing"],
+ "thingUri": "http://www.bbc.co.uk/things/37cd3473-7b24-44b0-84c1-bf3c4801df5e#id",
+ "topicId": "cwr9j9xxrxxt",
+ "topicName": "Вживання наркотиків"
},
{
- "curationList":[
+ "curationList": [
{
- "curationId":"c6c0f417-e128-4bb8-91af-01574c1068c4",
- "curationType":"vivo-stream"
+ "curationId": "c6c0f417-e128-4bb8-91af-01574c1068c4",
+ "curationType": "vivo-stream"
}
],
- "thingEnglishLabel":"Drugs trade",
- "thingId":"4b4cca1c-d458-4310-819e-dd48572b12c4",
- "thingLabel":"Наркоторгівля",
- "thingSameAs":[
- "http://dbpedia.org/resource/Illegal_drug_trade"
- ],
- "thingType":[
- "tagging:TagConcept",
- "core:Thing",
- "core:Theme"
- ],
- "thingUri":"http://www.bbc.co.uk/things/4b4cca1c-d458-4310-819e-dd48572b12c4#id",
- "topicId":"cwr9j9xxr90t",
- "topicName":"Наркоторгівля"
+ "thingEnglishLabel": "Drugs trade",
+ "thingId": "4b4cca1c-d458-4310-819e-dd48572b12c4",
+ "thingLabel": "Наркоторгівля",
+ "thingSameAs": ["http://dbpedia.org/resource/Illegal_drug_trade"],
+ "thingType": ["tagging:TagConcept", "core:Thing", "core:Theme"],
+ "thingUri": "http://www.bbc.co.uk/things/4b4cca1c-d458-4310-819e-dd48572b12c4#id",
+ "topicId": "cwr9j9xxr90t",
+ "topicName": "Наркоторгівля"
},
{
- "curationList":[
+ "curationList": [
{
- "curationId":"66aab782-10e3-47f5-a9cb-7432f6b24c83",
- "curationType":"vivo-stream"
+ "curationId": "66aab782-10e3-47f5-a9cb-7432f6b24c83",
+ "curationType": "vivo-stream"
}
],
- "thingEnglishLabel":"Ukraine",
- "thingId":"ee8750ed-a7fb-453f-bfca-2aa8b3fb064c",
- "thingLabel":"Україна",
- "thingSameAs":[
+ "thingEnglishLabel": "Ukraine",
+ "thingId": "ee8750ed-a7fb-453f-bfca-2aa8b3fb064c",
+ "thingLabel": "Україна",
+ "thingSameAs": [
"http://dbpedia.org/resource/Ukraine",
"http://www.wikidata.org/entity/Q212",
"http://sws.geonames.org/690791/"
],
- "thingType":[
- "tagging:TagConcept",
- "core:Thing",
- "core:Place"
- ],
- "thingUri":"http://www.bbc.co.uk/things/ee8750ed-a7fb-453f-bfca-2aa8b3fb064c#id",
- "topicId":"c1gdqr12p11t",
- "topicName":"Україна"
+ "thingType": ["tagging:TagConcept", "core:Thing", "core:Place"],
+ "thingUri": "http://www.bbc.co.uk/things/ee8750ed-a7fb-453f-bfca-2aa8b3fb064c#id",
+ "topicId": "c1gdqr12p11t",
+ "topicName": "Україна"
}
]
},
- "timestamp":1595942713000,
- "type":"STY",
- "version":"v1.3.2"
+ "timestamp": 1595942713000,
+ "type": "STY",
+ "version": "v1.3.2"
},
"promo":{
"headlines":{
diff --git a/src/app/components/ATIAnalytics/index.test.tsx b/src/app/components/ATIAnalytics/index.test.tsx
index 7b3b15d1795..e05a7b6b860 100644
--- a/src/app/components/ATIAnalytics/index.test.tsx
+++ b/src/app/components/ATIAnalytics/index.test.tsx
@@ -1,6 +1,5 @@
/* eslint-disable no-template-curly-in-string */
-import React, { PropsWithChildren } from 'react';
-import { render } from '@testing-library/react';
+import React from 'react';
import { articleDataNews } from '#pages/ArticlePage/fixtureData';
import mapAssetData from '#pages/MediaAssetPage/fixtureData.json';
import pglAssetData from '#pages/PhotoGalleryPage/fixtureData.json';
@@ -8,12 +7,12 @@ import styAssetData from '#pages/StoryPage/fixtureData/mundo.json';
import { data as fixData } from '#data/afrique/cpsAssets/48465371.json';
import styUkrainianAssetData from '#data/ukrainian/cpsAssets/news-53561143.json';
import styUkrainianInRussianAssetData from '#data/ukrainian/cpsAssets/features-russian-53477115.json';
-import { RequestContextProvider } from '#contexts/RequestContext';
import * as analyticsUtils from '#lib/analyticsUtils';
import {
setWindowValue,
resetWindowValue,
} from '#psammead/psammead-test-helpers/src';
+import { render } from '../react-testing-library-with-providers';
import {
ARTICLE_PAGE,
FRONT_PAGE,
@@ -24,11 +23,9 @@ import {
CORRESPONDENT_STORY_PAGE,
MEDIA_ARTICLE_PAGE,
} from '../../routes/utils/pageTypes';
-import { ServiceContextProvider } from '../../contexts/ServiceContext';
import ATIAnalytics from '.';
import * as amp from './amp';
import * as canonical from './canonical';
-import { PageTypes, Platforms, Services } from '../../models/types/global';
const { article: fixAssetData } = fixData;
@@ -40,33 +37,13 @@ const { article: fixAssetData } = fixData;
.fn()
.mockReturnValue('1970-01-01T00:00:00.000Z');
-interface Props {
- pageType: PageTypes;
- platform: Platforms;
- service: Services;
-}
-
-const ContextWrap = ({
- pageType,
- platform,
- children,
- service,
-}: PropsWithChildren) => (
-
-
- {children}
-
-
-);
+const defaultRenderProps = {
+ bbcOrigin: 'https://www.test.bbc.co.uk',
+ id: 'c0000000000o',
+ isApp: false,
+ statusCode: 200,
+ pathname: '/pathname',
+};
describe('ATI Analytics Container', () => {
beforeEach(() => {
@@ -79,21 +56,23 @@ describe('ATI Analytics Container', () => {
// @ts-expect-error - we need to mock these functions to ensure tests are deterministic
canonical.default = mockCanonical;
- render(
-
- {/* @ts-expect-error - only partial data required for testing purposes */}
-
- ,
- );
+ const {
+ metadata: { atiAnalytics },
+ } = articleDataNews;
+
+ render(, {
+ ...defaultRenderProps,
+ atiData: atiAnalytics,
+ isAmp: false,
+ pageData: articleDataNews,
+ pageType: ARTICLE_PAGE,
+ service: 'news',
+ });
const { pageviewParams } = mockCanonical.mock.calls[0][0];
const parsedATIParams = Object.fromEntries(
- new URLSearchParams(pageviewParams as string),
+ new URLSearchParams(pageviewParams),
);
expect(parsedATIParams).toEqual({
@@ -112,8 +91,8 @@ describe('ATI Analytics Container', () => {
x7: '[article]',
x8: '[simorgh]',
x9: '[Article%20Headline%20for%20SEO]',
- x11: '[1970-01-01T00:00:00.000Z]',
- x12: '[1970-01-01T00:00:00.000Z]',
+ x11: '[2018-01-01T12:01:00.000Z]',
+ x12: '[2018-01-01T14:00:00.000Z]',
x13: '[Royal%20Wedding%202018~Duchess%20of%20Sussex]',
x14: '[2351f2b2-ce36-4f44-996d-c3c4f7f90eaa~803eaeb9-c0c3-4f1b-9a66-90efac3df2dc]',
x17: '[Royal%20Wedding%202018~Duchess%20of%20Sussex]',
@@ -126,12 +105,18 @@ describe('ATI Analytics Container', () => {
// @ts-expect-error - we need to mock these functions to ensure tests are deterministic
amp.default = mockAmp;
- render(
-
- {/* @ts-expect-error - only partial data required for testing purposes */}
-
- ,
- );
+ const {
+ metadata: { atiAnalytics },
+ } = articleDataNews;
+
+ render(, {
+ ...defaultRenderProps,
+ atiData: atiAnalytics,
+ isAmp: true,
+ pageData: articleDataNews,
+ pageType: ARTICLE_PAGE,
+ service: 'news',
+ });
const { pageviewParams } = mockAmp.mock.calls[0][0];
@@ -156,8 +141,8 @@ describe('ATI Analytics Container', () => {
x7: '[article]',
x8: '[simorgh]',
x9: '[Article%20Headline%20for%20SEO]',
- x11: '[1970-01-01T00:00:00.000Z]',
- x12: '[1970-01-01T00:00:00.000Z]',
+ x11: '[2018-01-01T12:01:00.000Z]',
+ x12: '[2018-01-01T14:00:00.000Z]',
x13: '[Royal%20Wedding%202018~Duchess%20of%20Sussex]',
x14: '[2351f2b2-ce36-4f44-996d-c3c4f7f90eaa~803eaeb9-c0c3-4f1b-9a66-90efac3df2dc]',
x17: '[Royal%20Wedding%202018~Duchess%20of%20Sussex]',
@@ -172,16 +157,14 @@ describe('ATI Analytics Container', () => {
// @ts-expect-error - we need to mock these functions to ensure tests are deterministic
canonical.default = mockCanonical;
- render(
-
- {/* @ts-expect-error - only partial data required for testing purposes */}
-
- ,
- );
+ /* @ts-expect-error - only partial data required for testing purposes */
+ render(, {
+ ...defaultRenderProps,
+ isAmp: false,
+ pageData: articleDataNews,
+ pageType: MEDIA_ARTICLE_PAGE,
+ service: 'news',
+ });
const { pageviewParams } = mockCanonical.mock.calls[0][0];
@@ -219,16 +202,14 @@ describe('ATI Analytics Container', () => {
// @ts-expect-error - we need to mock these functions to ensure tests are deterministic
amp.default = mockAmp;
- render(
-
- {/* @ts-expect-error - only partial data required for testing purposes */}
-
- ,
- );
+ /* @ts-expect-error - only partial data required for testing purposes */
+ render(, {
+ ...defaultRenderProps,
+ isAmp: true,
+ pageData: articleDataNews,
+ pageType: MEDIA_ARTICLE_PAGE,
+ service: 'news',
+ });
const { pageviewParams } = mockAmp.mock.calls[0][0];
@@ -269,12 +250,14 @@ describe('ATI Analytics Container', () => {
// @ts-expect-error - we need to mock these functions to ensure tests are deterministic
canonical.default = mockCanonical;
- render(
-
- {/* @ts-expect-error - only partial data required for testing purposes */}
-
- ,
- );
+ /* @ts-expect-error - only partial data required for testing purposes */
+ render(, {
+ ...defaultRenderProps,
+ isAmp: false,
+ pageData: articleDataNews,
+ pageType: FRONT_PAGE,
+ service: 'news',
+ });
const { pageviewParams } = mockCanonical.mock.calls[0][0];
@@ -306,12 +289,14 @@ describe('ATI Analytics Container', () => {
// @ts-expect-error - we need to mock these functions to ensure tests are deterministic
amp.default = mockAmp;
- render(
-
- {/* @ts-expect-error - only partial data required for testing purposes */}
-
- ,
- );
+ /* @ts-expect-error - only partial data required for testing purposes */
+ render(, {
+ ...defaultRenderProps,
+ isAmp: true,
+ pageData: articleDataNews,
+ pageType: FRONT_PAGE,
+ service: 'news',
+ });
const { pageviewParams } = mockAmp.mock.calls[0][0];
@@ -347,15 +332,23 @@ describe('ATI Analytics Container', () => {
// @ts-expect-error - we need to mock these functions to ensure tests are deterministic
amp.default = mockAmp;
- render(
-
-
- ,
- );
+ const {
+ metadata: { atiAnalytics },
+ } = mapAssetData;
+
+ const atiData = {
+ ...atiAnalytics,
+ pageTitle: `${atiAnalytics.pageTitle} - BBC News Pidgin`,
+ };
+
+ render(, {
+ ...defaultRenderProps,
+ atiData: atiAnalytics,
+ isAmp: true,
+ pageData: mapAssetData,
+ pageType: MEDIA_ASSET_PAGE,
+ service: 'pidgin',
+ });
const { pageviewParams } = mockAmp.mock.calls[0][0];
@@ -371,6 +364,7 @@ describe('ATI Analytics Container', () => {
re: '${availableScreenWidth}x${availableScreenHeight}',
hl: '00-00-00',
lng: '${browserLanguage}',
+ x1: '[urn:bbc:cps:curie:asset:5679389a-3ea6-0b40-9de4-f4d33d6bcd9f]',
x2: '[amp]',
x3: '[news-pidgin]',
x4: '[pcm]',
@@ -379,8 +373,8 @@ describe('ATI Analytics Container', () => {
x7: '[article-media-asset]',
x8: '[simorgh]',
x9: '[Simorgh:%20Media%20Pod%20Build%20First%20CPS%20Media%20Asset%20Page%20in%20Simorgh%20&%20<%20>%20-%20BBC%20News%20Pidgin]',
- x11: '[1970-01-01T00:00:00.000Z]',
- x12: '[1970-01-01T00:00:00.000Z]',
+ x11: '[2019-09-13T15:31:44.000Z]',
+ x12: '[2020-06-10T14:24:07.000Z]',
x16: '[Inspire me~Give me perspective~Keep me on trend]',
x17: '[Opinion]',
ref: '${documentReferrer}',
@@ -394,15 +388,23 @@ describe('ATI Analytics Container', () => {
// @ts-expect-error - we need to mock these functions to ensure tests are deterministic
canonical.default = mockCanonical;
- render(
-
-
- ,
- );
+ const {
+ metadata: { atiAnalytics },
+ } = pglAssetData;
+
+ const atiData = {
+ ...atiAnalytics,
+ pageTitle: `${atiAnalytics.pageTitle} - BBC News Azərbaycanca`,
+ };
+
+ render(, {
+ ...defaultRenderProps,
+ atiData: atiAnalytics,
+ isAmp: false,
+ pageData: pglAssetData,
+ pageType: PHOTO_GALLERY_PAGE,
+ service: 'azeri',
+ });
const { pageviewParams } = mockCanonical.mock.calls[0][0];
@@ -418,6 +420,7 @@ describe('ATI Analytics Container', () => {
re: '1024x768',
hl: '00-00-00',
lng: 'en-US',
+ x1: '[urn:bbc:cps:curie:asset:38229308-a0fb-654a-a274-19bec0414560]',
x2: '[responsive]',
x3: '[news-azeri]',
x4: '[az]',
@@ -425,9 +428,9 @@ describe('ATI Analytics Container', () => {
x7: '[article-photo-gallery]',
x8: '[simorgh]',
x9: '[Azərbaycan%20Xalq%20Cümhuriyyəti%20-%20Fotolarda%20-%20BBC%20News%20Azərbaycanca]',
- x11: '[1970-01-01T00:00:00.000Z]',
- x12: '[1970-01-01T00:00:00.000Z]',
- x13: '[History~Azerbaijan~Society~Culture~Politics~Human%20rights~Azerbaijan%20Democratic%20Republic%20100th%20anniversary~Caucasus~Law%20and%20order]',
+ x11: '[2018-05-27T08:34:15.000Z]',
+ x12: '[2018-05-27T08:34:15.000Z]',
+ x13: '[History~Azerbaijan~Society~Culture~Politics~Human+rights~Azerbaijan+Democratic+Republic+100th+anniversary~Caucasus~Law+and+order]',
x14: '[03eb3674-6190-4cd7-8104-1a00991d67a3~0f8e45e2-6499-44b1-be1f-1a3dd81e8af7~5307a8d9-f620-40f5-92d4-f99c919a6ffa~6a73afa3-ea6b-45c1-80bb-49060b99f864~75612fa6-147c-4a43-97fa-fcf70d9cced3~8b04c2e8-5409-4e7d-9877-3ccaf04727af~9e6f8e15-894a-45cb-9db9-d8881e8e6ae2~a86bc15e-ccd0-4ea9-9903-df3d4575a176~d94f45db-bb47-4e7b-b1a2-5bc3e6afd0aa]',
x17: '[News]',
});
@@ -439,15 +442,23 @@ describe('ATI Analytics Container', () => {
// @ts-expect-error - we need to mock these functions to ensure tests are deterministic
amp.default = mockAmp;
- render(
-
-
- ,
- );
+ const {
+ metadata: { atiAnalytics },
+ } = pglAssetData;
+
+ const atiData = {
+ ...atiAnalytics,
+ pageTitle: `${atiAnalytics.pageTitle} - BBC News Azərbaycanca`,
+ };
+
+ render(, {
+ ...defaultRenderProps,
+ atiData: atiAnalytics,
+ isAmp: true,
+ pageData: pglAssetData,
+ pageType: PHOTO_GALLERY_PAGE,
+ service: 'azeri',
+ });
const { pageviewParams } = mockAmp.mock.calls[0][0];
@@ -463,6 +474,7 @@ describe('ATI Analytics Container', () => {
re: '${availableScreenWidth}x${availableScreenHeight}',
hl: '00-00-00',
lng: '${browserLanguage}',
+ x1: '[urn:bbc:cps:curie:asset:38229308-a0fb-654a-a274-19bec0414560]',
x2: '[amp]',
x3: '[news-azeri]',
x4: '[az]',
@@ -471,9 +483,9 @@ describe('ATI Analytics Container', () => {
x7: '[article-photo-gallery]',
x8: '[simorgh]',
x9: '[Azərbaycan%20Xalq%20Cümhuriyyəti%20-%20Fotolarda%20-%20BBC%20News%20Azərbaycanca]',
- x11: '[1970-01-01T00:00:00.000Z]',
- x12: '[1970-01-01T00:00:00.000Z]',
- x13: '[History~Azerbaijan~Society~Culture~Politics~Human%20rights~Azerbaijan%20Democratic%20Republic%20100th%20anniversary~Caucasus~Law%20and%20order]',
+ x11: '[2018-05-27T08:34:15.000Z]',
+ x12: '[2018-05-27T08:34:15.000Z]',
+ x13: '[History~Azerbaijan~Society~Culture~Politics~Human+rights~Azerbaijan+Democratic+Republic+100th+anniversary~Caucasus~Law+and+order]',
x14: '[03eb3674-6190-4cd7-8104-1a00991d67a3~0f8e45e2-6499-44b1-be1f-1a3dd81e8af7~5307a8d9-f620-40f5-92d4-f99c919a6ffa~6a73afa3-ea6b-45c1-80bb-49060b99f864~75612fa6-147c-4a43-97fa-fcf70d9cced3~8b04c2e8-5409-4e7d-9877-3ccaf04727af~9e6f8e15-894a-45cb-9db9-d8881e8e6ae2~a86bc15e-ccd0-4ea9-9903-df3d4575a176~d94f45db-bb47-4e7b-b1a2-5bc3e6afd0aa]',
x17: '[News]',
ref: '${documentReferrer}',
@@ -487,11 +499,23 @@ describe('ATI Analytics Container', () => {
// @ts-expect-error - we need to mock these functions to ensure tests are deterministic
canonical.default = mockCanonical;
- render(
-
-
- ,
- );
+ const {
+ metadata: { atiAnalytics },
+ } = styAssetData;
+
+ const atiData = {
+ ...atiAnalytics,
+ pageTitle: `${atiAnalytics.pageTitle} - BBC News Mundo`,
+ };
+
+ render(, {
+ ...defaultRenderProps,
+ atiData: atiAnalytics,
+ isAmp: false,
+ pageData: styAssetData,
+ pageType: STORY_PAGE,
+ service: 'mundo',
+ });
const { pageviewParams } = mockCanonical.mock.calls[0][0];
@@ -507,6 +531,7 @@ describe('ATI Analytics Container', () => {
re: '1024x768',
hl: '00-00-00',
lng: 'en-US',
+ x1: '[urn:bbc:cps:curie:asset:f776ad93-e486-b14a-b5ea-55955dd0644f]',
x2: '[responsive]',
x3: '[news-mundo]',
x4: '[es]',
@@ -514,9 +539,9 @@ describe('ATI Analytics Container', () => {
x7: '[article]',
x8: '[simorgh]',
x9: '[WS%20STY%20TEST%20-%20Full%20Headline%20-%20BBC%20News%20Mundo]',
- x11: '[1970-01-01T00:00:00.000Z]',
- x12: '[1970-01-01T00:00:00.000Z]',
- x13: '[Life~Fake%20news]',
+ x11: '[2020-02-03T15:58:27.000Z]',
+ x12: '[2020-05-06T11:02:07.000Z]',
+ x13: '[Life~Fake+news]',
x14: '[0239ab33-1cfc-4f5d-babb-a8159711af3e~e7539dc8-5cfb-413a-b4fe-0ad77bc665aa]',
x16: '[Amuse me]',
x17: '[News]',
@@ -528,11 +553,23 @@ describe('ATI Analytics Container', () => {
// @ts-expect-error - we need to mock these functions to ensure tests are deterministic
amp.default = mockAmp;
- render(
-
-
- ,
- );
+ const {
+ metadata: { atiAnalytics },
+ } = styAssetData;
+
+ const atiData = {
+ ...atiAnalytics,
+ pageTitle: `${atiAnalytics.pageTitle} - BBC News Mundo`,
+ };
+
+ render(, {
+ ...defaultRenderProps,
+ atiData: atiAnalytics,
+ isAmp: true,
+ pageData: styAssetData,
+ pageType: STORY_PAGE,
+ service: 'mundo',
+ });
const { pageviewParams } = mockAmp.mock.calls[0][0];
@@ -548,6 +585,7 @@ describe('ATI Analytics Container', () => {
re: '${availableScreenWidth}x${availableScreenHeight}',
hl: '00-00-00',
lng: '${browserLanguage}',
+ x1: '[urn:bbc:cps:curie:asset:f776ad93-e486-b14a-b5ea-55955dd0644f]',
x2: '[amp]',
x3: '[news-mundo]',
x4: '[es]',
@@ -556,9 +594,9 @@ describe('ATI Analytics Container', () => {
x7: '[article]',
x8: '[simorgh]',
x9: '[WS%20STY%20TEST%20-%20Full%20Headline%20-%20BBC%20News%20Mundo]',
- x11: '[1970-01-01T00:00:00.000Z]',
- x12: '[1970-01-01T00:00:00.000Z]',
- x13: '[Life~Fake%20news]',
+ x11: '[2020-02-03T15:58:27.000Z]',
+ x12: '[2020-05-06T11:02:07.000Z]',
+ x13: '[Life~Fake+news]',
x14: '[0239ab33-1cfc-4f5d-babb-a8159711af3e~e7539dc8-5cfb-413a-b4fe-0ad77bc665aa]',
x16: '[Amuse me]',
x17: '[News]',
@@ -571,15 +609,24 @@ describe('ATI Analytics Container', () => {
// @ts-expect-error - we need to mock these functions to ensure tests are deterministic
amp.default = mockAmp;
- render(
-
-
- ,
- );
+ const {
+ metadata: { atiAnalytics },
+ } = styAssetData;
+
+ const atiData = {
+ ...atiAnalytics,
+ contentType: 'article-correspondent',
+ pageTitle: `${atiAnalytics.pageTitle} - BBC News Mundo`,
+ };
+
+ render(, {
+ ...defaultRenderProps,
+ atiData: atiAnalytics,
+ isAmp: true,
+ pageData: styAssetData,
+ pageType: CORRESPONDENT_STORY_PAGE,
+ service: 'mundo',
+ });
const { pageviewParams } = mockAmp.mock.calls[0][0];
@@ -595,6 +642,7 @@ describe('ATI Analytics Container', () => {
re: '${availableScreenWidth}x${availableScreenHeight}',
hl: '00-00-00',
lng: '${browserLanguage}',
+ x1: '[urn:bbc:cps:curie:asset:f776ad93-e486-b14a-b5ea-55955dd0644f]',
x2: '[amp]',
x3: '[news-mundo]',
x4: '[es]',
@@ -603,9 +651,9 @@ describe('ATI Analytics Container', () => {
x7: '[article-correspondent]',
x8: '[simorgh]',
x9: '[WS%20STY%20TEST%20-%20Full%20Headline%20-%20BBC%20News%20Mundo]',
- x11: '[1970-01-01T00:00:00.000Z]',
- x12: '[1970-01-01T00:00:00.000Z]',
- x13: '[Life~Fake%20news]',
+ x11: '[2020-02-03T15:58:27.000Z]',
+ x12: '[2020-05-06T11:02:07.000Z]',
+ x13: '[Life~Fake+news]',
x14: '[0239ab33-1cfc-4f5d-babb-a8159711af3e~e7539dc8-5cfb-413a-b4fe-0ad77bc665aa]',
x16: '[Amuse me]',
x17: '[News]',
@@ -618,15 +666,23 @@ describe('ATI Analytics Container', () => {
// @ts-expect-error - we need to mock these functions to ensure tests are deterministic
canonical.default = mockCanonical;
- render(
-
-
- ,
- );
+ const {
+ metadata: { atiAnalytics },
+ } = styUkrainianAssetData;
+
+ const atiData = {
+ ...atiAnalytics,
+ pageTitle: `${atiAnalytics.pageTitle} - BBC News Україна`,
+ };
+
+ render(, {
+ ...defaultRenderProps,
+ atiData,
+ isAmp: false,
+ pageData: styUkrainianAssetData,
+ pageType: STORY_PAGE,
+ service: 'ukrainian',
+ });
const { pageviewParams } = mockCanonical.mock.calls[0][0];
@@ -642,6 +698,7 @@ describe('ATI Analytics Container', () => {
re: '1024x768',
hl: '00-00-00',
lng: 'en-US',
+ x1: '[urn:bbc:cps:curie:asset:9e539daf-1d79-4630-900c-7db33c4bf1ac]',
x2: '[responsive]',
x3: '[news-ukrainian]',
x4: '[uk]',
@@ -649,9 +706,9 @@ describe('ATI Analytics Container', () => {
x7: '[article]',
x8: '[simorgh]',
x9: '[Виробництво%20героїну%20зросло%20завдяки%20сонячним%20батареям.%20Погляд%20з%20Британії%20-%20BBC%20News%20Україна]',
- x11: '[1970-01-01T00:00:00.000Z]',
- x12: '[1970-01-01T00:00:00.000Z]',
- x13: '[Afghanistan~Drug%20use~Drugs%20trade~Ukraine]',
+ x11: '[2020-07-28T13:25:13.000Z]',
+ x12: '[2020-07-28T13:25:13.000Z]',
+ x13: '[Afghanistan~Drug+use~Drugs+trade~Ukraine]',
x14: '[1a5696c5-07d0-4a08-8b54-41ad5cd534b6~37cd3473-7b24-44b0-84c1-bf3c4801df5e~4b4cca1c-d458-4310-819e-dd48572b12c4~ee8750ed-a7fb-453f-bfca-2aa8b3fb064c]',
x16: '[WS - Educate me]',
x17: '[News]',
@@ -663,11 +720,23 @@ describe('ATI Analytics Container', () => {
// @ts-expect-error - we need to mock these functions to ensure tests are deterministic
amp.default = mockAmp;
- render(
-
-
- ,
- );
+ const {
+ metadata: { atiAnalytics },
+ } = styUkrainianAssetData;
+
+ const atiData = {
+ ...atiAnalytics,
+ pageTitle: `${atiAnalytics.pageTitle} - BBC News Україна`,
+ };
+
+ render(, {
+ ...defaultRenderProps,
+ atiData,
+ isAmp: true,
+ pageData: styUkrainianAssetData,
+ pageType: STORY_PAGE,
+ service: 'ukrainian',
+ });
const { pageviewParams } = mockAmp.mock.calls[0][0];
@@ -683,6 +752,7 @@ describe('ATI Analytics Container', () => {
re: '${availableScreenWidth}x${availableScreenHeight}',
hl: '00-00-00',
lng: '${browserLanguage}',
+ x1: '[urn:bbc:cps:curie:asset:9e539daf-1d79-4630-900c-7db33c4bf1ac]',
x2: '[amp]',
x3: '[news-ukrainian]',
x4: '[uk]',
@@ -691,9 +761,9 @@ describe('ATI Analytics Container', () => {
x7: '[article]',
x8: '[simorgh]',
x9: '[Виробництво%20героїну%20зросло%20завдяки%20сонячним%20батареям.%20Погляд%20з%20Британії%20-%20BBC%20News%20Україна]',
- x11: '[1970-01-01T00:00:00.000Z]',
- x12: '[1970-01-01T00:00:00.000Z]',
- x13: '[Afghanistan~Drug%20use~Drugs%20trade~Ukraine]',
+ x11: '[2020-07-28T13:25:13.000Z]',
+ x12: '[2020-07-28T13:25:13.000Z]',
+ x13: '[Afghanistan~Drug+use~Drugs+trade~Ukraine]',
x14: '[1a5696c5-07d0-4a08-8b54-41ad5cd534b6~37cd3473-7b24-44b0-84c1-bf3c4801df5e~4b4cca1c-d458-4310-819e-dd48572b12c4~ee8750ed-a7fb-453f-bfca-2aa8b3fb064c]',
x16: '[WS - Educate me]',
x17: '[News]',
@@ -706,15 +776,23 @@ describe('ATI Analytics Container', () => {
// @ts-expect-error - we need to mock these functions to ensure tests are deterministic
canonical.default = mockCanonical;
- render(
-
-
- ,
- );
+ const {
+ metadata: { atiAnalytics },
+ } = styUkrainianInRussianAssetData;
+
+ const atiData = {
+ ...atiAnalytics,
+ pageTitle: `${atiAnalytics.pageTitle} - BBC News Україна`,
+ };
+
+ render(, {
+ ...defaultRenderProps,
+ atiData,
+ isAmp: false,
+ pageData: styUkrainianInRussianAssetData,
+ pageType: STORY_PAGE,
+ service: 'ukrainian',
+ });
const { pageviewParams } = mockCanonical.mock.calls[0][0];
@@ -730,6 +808,7 @@ describe('ATI Analytics Container', () => {
re: '1024x768',
hl: '00-00-00',
lng: 'en-US',
+ x1: '[urn:bbc:cps:curie:asset:307108d3-9bcc-4829-990c-4b42c1290258]',
x2: '[responsive]',
x3: '[news-ukrainian]',
x4: '[ru]',
@@ -737,8 +816,8 @@ describe('ATI Analytics Container', () => {
x7: '[article]',
x8: '[simorgh]',
x9: '[Карта%20новых%20районов%20Украины:%20кто%20и%20кого%20поглотил%20-%20BBC%20News%20Україна]',
- x11: '[1970-01-01T00:00:00.000Z]',
- x12: '[1970-01-01T00:00:00.000Z]',
+ x11: '[2020-07-21T13:00:09.000Z]',
+ x12: '[2020-07-21T13:00:09.000Z]',
x13: '[Society~Politics~Ukraine]',
x14: '[5307a8d9-f620-40f5-92d4-f99c919a6ffa~75612fa6-147c-4a43-97fa-fcf70d9cced3~ee8750ed-a7fb-453f-bfca-2aa8b3fb064c]',
x16: '[WS - Update me]',
@@ -751,11 +830,23 @@ describe('ATI Analytics Container', () => {
// @ts-expect-error - we need to mock these functions to ensure tests are deterministic
amp.default = mockAmp;
- render(
-
-
- ,
- );
+ const {
+ metadata: { atiAnalytics },
+ } = styUkrainianInRussianAssetData;
+
+ const atiData = {
+ ...atiAnalytics,
+ pageTitle: `${atiAnalytics.pageTitle} - BBC News Україна`,
+ };
+
+ render(, {
+ ...defaultRenderProps,
+ atiData,
+ isAmp: true,
+ pageData: styUkrainianInRussianAssetData,
+ pageType: STORY_PAGE,
+ service: 'ukrainian',
+ });
const { pageviewParams } = mockAmp.mock.calls[0][0];
@@ -771,6 +862,7 @@ describe('ATI Analytics Container', () => {
re: '${availableScreenWidth}x${availableScreenHeight}',
hl: '00-00-00',
lng: '${browserLanguage}',
+ x1: '[urn:bbc:cps:curie:asset:307108d3-9bcc-4829-990c-4b42c1290258]',
x2: '[amp]',
x3: '[news-ukrainian]',
x4: '[ru]',
@@ -779,8 +871,8 @@ describe('ATI Analytics Container', () => {
x7: '[article]',
x8: '[simorgh]',
x9: '[Карта%20новых%20районов%20Украины:%20кто%20и%20кого%20поглотил%20-%20BBC%20News%20Україна]',
- x11: '[1970-01-01T00:00:00.000Z]',
- x12: '[1970-01-01T00:00:00.000Z]',
+ x11: '[2020-07-21T13:00:09.000Z]',
+ x12: '[2020-07-21T13:00:09.000Z]',
x13: '[Society~Politics~Ukraine]',
x14: '[5307a8d9-f620-40f5-92d4-f99c919a6ffa~75612fa6-147c-4a43-97fa-fcf70d9cced3~ee8750ed-a7fb-453f-bfca-2aa8b3fb064c]',
x16: '[WS - Update me]',
@@ -804,11 +896,23 @@ describe('ATI Analytics Container', () => {
// @ts-expect-error - we need to mock these functions to ensure tests are deterministic
canonical.default = mockCanonical;
- render(
-
-
- ,
- );
+ const {
+ metadata: { atiAnalytics },
+ } = styAssetData;
+
+ const atiData = {
+ ...atiAnalytics,
+ pageTitle: `${atiAnalytics.pageTitle} - BBC News Mundo`,
+ };
+
+ render(, {
+ ...defaultRenderProps,
+ atiData,
+ isAmp: false,
+ pageData: styAssetData,
+ pageType: STORY_PAGE,
+ service: 'mundo',
+ });
const { pageviewParams } = mockCanonical.mock.calls[0][0];
@@ -824,6 +928,7 @@ describe('ATI Analytics Container', () => {
re: '1024x768',
hl: '00-00-00',
lng: 'en-US',
+ x1: '[urn:bbc:cps:curie:asset:f776ad93-e486-b14a-b5ea-55955dd0644f]',
x2: '[responsive]',
x3: '[news-mundo]',
x4: '[es]',
@@ -831,9 +936,9 @@ describe('ATI Analytics Container', () => {
x7: '[article]',
x8: '[simorgh]',
x9: '[WS%20STY%20TEST%20-%20Full%20Headline%20-%20BBC%20News%20Mundo]',
- x11: '[1970-01-01T00:00:00.000Z]',
- x12: '[1970-01-01T00:00:00.000Z]',
- x13: '[Life~Fake%20news]',
+ x11: '[2020-02-03T15:58:27.000Z]',
+ x12: '[2020-05-06T11:02:07.000Z]',
+ x13: '[Life~Fake+news]',
x14: '[0239ab33-1cfc-4f5d-babb-a8159711af3e~e7539dc8-5cfb-413a-b4fe-0ad77bc665aa]',
x16: '[Amuse me]',
x17: '[News]',
@@ -848,11 +953,23 @@ describe('ATI Analytics Container', () => {
// @ts-expect-error - we need to mock these functions to ensure tests are deterministic
canonical.default = mockCanonical;
- render(
-
-
- ,
- );
+ const {
+ metadata: { atiAnalytics },
+ } = styAssetData;
+
+ const atiData = {
+ ...atiAnalytics,
+ pageTitle: `${atiAnalytics.pageTitle} - BBC News Mundo`,
+ };
+
+ render(, {
+ ...defaultRenderProps,
+ atiData,
+ isAmp: false,
+ pageData: styAssetData,
+ pageType: STORY_PAGE,
+ service: 'mundo',
+ });
const { pageviewParams } = mockCanonical.mock.calls[0][0];
@@ -868,6 +985,7 @@ describe('ATI Analytics Container', () => {
re: '1024x768',
hl: '00-00-00',
lng: 'en-US',
+ x1: '[urn:bbc:cps:curie:asset:f776ad93-e486-b14a-b5ea-55955dd0644f]',
x2: '[responsive]',
x3: '[news-mundo]',
x4: '[es]',
@@ -875,9 +993,9 @@ describe('ATI Analytics Container', () => {
x7: '[article]',
x8: '[simorgh]',
x9: '[WS%20STY%20TEST%20-%20Full%20Headline%20-%20BBC%20News%20Mundo]',
- x11: '[1970-01-01T00:00:00.000Z]',
- x12: '[1970-01-01T00:00:00.000Z]',
- x13: '[Life~Fake%20news]',
+ x11: '[2020-02-03T15:58:27.000Z]',
+ x12: '[2020-05-06T11:02:07.000Z]',
+ x13: '[Life~Fake+news]',
x14: '[0239ab33-1cfc-4f5d-babb-a8159711af3e~e7539dc8-5cfb-413a-b4fe-0ad77bc665aa]',
x16: '[Amuse me]',
x17: '[News]',
@@ -890,15 +1008,13 @@ describe('ATI Analytics Container', () => {
// @ts-expect-error - we need to mock these functions to ensure tests are deterministic
canonical.default = mockCanonical;
- render(
-
-
- ,
- );
+ render(, {
+ ...defaultRenderProps,
+ isAmp: false,
+ pageData: fixAssetData,
+ pageType: FEATURE_INDEX_PAGE,
+ service: 'afrique',
+ });
const { pageviewParams } = mockCanonical.mock.calls[0][0];
@@ -932,15 +1048,13 @@ describe('ATI Analytics Container', () => {
// @ts-expect-error - we need to mock these functions to ensure tests are deterministic
amp.default = mockAmp;
- render(
-
-
- ,
- );
+ render(, {
+ ...defaultRenderProps,
+ isAmp: true,
+ pageData: fixAssetData,
+ pageType: FEATURE_INDEX_PAGE,
+ service: 'afrique',
+ });
const { pageviewParams } = mockAmp.mock.calls[0][0];
diff --git a/src/app/components/ATIAnalytics/params/cpsAssetPage/buildParams.test.ts b/src/app/components/ATIAnalytics/params/cpsAssetPage/buildParams.test.ts
deleted file mode 100644
index f1be90cdae2..00000000000
--- a/src/app/components/ATIAnalytics/params/cpsAssetPage/buildParams.test.ts
+++ /dev/null
@@ -1,206 +0,0 @@
-import * as analyticsUtils from '#lib/analyticsUtils';
-import { data as cpsMapData } from '#data/pidgin/cpsAssets/tori-49450859.json';
-import payloadLegacy from '#data/gahuza/legacyAssets/video/2016/01/160108_australia_fire_video.json';
-import {
- buildCpsAssetPageATIParams,
- buildCpsAssetPageATIUrl,
-} from './buildParams';
-import { RequestContextProps } from '../../../../contexts/RequestContext';
-import { ServiceConfig } from '../../../../models/types/serviceConfig';
-
-const { article: payload } = cpsMapData;
-
-// Mocks
-(analyticsUtils.getAtUserId as jest.Mock) = jest.fn();
-(analyticsUtils.getCurrentTime as jest.Mock) = jest
- .fn()
- .mockReturnValue('00-00-00');
-(analyticsUtils.getPublishedDatetime as jest.Mock) = jest
- .fn()
- .mockReturnValue('1970-01-01T00:00:00.000Z');
-
-// Fixtures
-// @ts-expect-error - only partial data required for testing purposes
-const requestContext: RequestContextProps = {
- platform: 'canonical',
- isUK: true,
- statsDestination: 'statsDestination',
- previousPath: 'previousPath',
- origin: 'origin',
- canonicalLink: 'https://www.bbc.com/pidgin/51536047',
-};
-
-// @ts-expect-error - only partial data required for testing purposes
-const requestContextLegacy: RequestContextProps = {
- platform: 'canonical',
- isUK: true,
- statsDestination: 'statsDestination',
- previousPath: 'previousPath',
- origin: 'origin',
- canonicalLink:
- 'https://www.bbc.com/gahuza/video/2016/01/160108_australia_fire_video',
-};
-
-// @ts-expect-error - only partial data required for testing purposes
-const serviceContext: ServiceConfig = {
- atiAnalyticsAppName: 'atiAnalyticsAppName',
- atiAnalyticsProducerId: 'atiAnalyticsProducerId',
- service: 'pidgin',
- brandName: 'Some BBC Brand',
-};
-
-// @ts-expect-error - only partial data required for testing purposes
-const newsServiceContext: ServiceConfig = {
- atiAnalyticsAppName: 'atiAnalyticsAppName',
- atiAnalyticsProducerId: 'atiAnalyticsProducerId',
- service: 'news',
- brandName: 'Some BBC Brand',
-};
-
-const expectation = {
- appName: serviceContext.atiAnalyticsAppName,
- categoryName: 'News',
- campaigns: payload.metadata.passport.campaigns,
- contentId: 'urn:bbc:cps:curie:asset:a753e377-f11b-5646-9c9b-4775bfa4e692',
- contentType: 'test-content-type',
- language: payload.metadata.language,
- libraryVersion: analyticsUtils.LIBRARY_VERSION,
- pageIdentifier: `news::${payload.metadata.analyticsLabels.counterName}`,
- pageTitle: `${payload.promo.headlines.headline} - ${serviceContext.brandName}`,
- platform: requestContext.platform,
- producerId: serviceContext.atiAnalyticsProducerId,
- statsDestination: requestContext.statsDestination,
- service: 'pidgin',
- timePublished: analyticsUtils.getPublishedDatetime(),
- timeUpdated: analyticsUtils.getPublishedDatetime(),
- ldpThingLabels: 'Technology~Nigeria',
- ldpThingIds:
- '31684f19-84d6-41f6-b033-7ae08098572a~3d5d5e30-dd50-4041-96d5-c970b20005b9',
-};
-
-const expectationLegacy = {
- appName: serviceContext.atiAnalyticsAppName,
- contentId: 'urn:bbc:cps:curie:asset:a753e377-f11b-5646-9c9b-4775bfa4e692',
- contentType: 'test-content-type',
- language: payloadLegacy.metadata.language,
- libraryVersion: analyticsUtils.LIBRARY_VERSION,
- pageTitle: `${payloadLegacy.promo.headlines.headline} - ${serviceContext.brandName}`,
- platform: requestContextLegacy.platform,
- producerId: serviceContext.atiAnalyticsProducerId,
- statsDestination: requestContextLegacy.statsDestination,
- service: 'pidgin',
- timePublished: analyticsUtils.getPublishedDatetime(),
- timeUpdated: analyticsUtils.getPublishedDatetime(),
-};
-
-const newsExpectation = {
- appName: serviceContext.atiAnalyticsAppName,
- categoryName: 'News',
- campaigns: payload.metadata.passport.campaigns,
- contentId: 'urn:bbc:cps:curie:asset:a753e377-f11b-5646-9c9b-4775bfa4e692',
- contentType: 'test-content-type',
- language: payload.metadata.language,
- libraryVersion: analyticsUtils.LIBRARY_VERSION,
- pageIdentifier: `overrideAtiChapter::${payload.metadata.analyticsLabels.counterName}`,
- pageTitle: `${payload.promo.headlines.headline} - ${serviceContext.brandName}`,
- platform: requestContext.platform,
- producerId: 'overrideProducerId',
- statsDestination: requestContext.statsDestination,
- service: 'news',
- timePublished: analyticsUtils.getPublishedDatetime(),
- timeUpdated: analyticsUtils.getPublishedDatetime(),
- ldpThingLabels: 'Technology~Nigeria',
- ldpThingIds:
- '31684f19-84d6-41f6-b033-7ae08098572a~3d5d5e30-dd50-4041-96d5-c970b20005b9',
-};
-
-describe('buildCpsAssetPageATIParams', () => {
- it('should return the correct object', () => {
- const result = buildCpsAssetPageATIParams(
- payload,
- requestContext,
- serviceContext,
- 'test-content-type',
- );
- expect(result).toEqual(expectation);
- });
-
- it('should handle invalid counter name', () => {
- const payloadInvalidCounterName = {
- ...payload,
- metadata: {
- ...payload.metadata,
- analyticsLabels: {
- ...payload.metadata.analyticsLabels,
- counterName: 'invalid',
- },
- },
- };
- const result = buildCpsAssetPageATIParams(
- payloadInvalidCounterName,
- requestContext,
- serviceContext,
- 'test-content-type',
- );
- expect(result).toEqual({ ...expectation, pageIdentifier: 'invalid' });
- });
-
- it('should return the correct object for a legacy asset', () => {
- const result = buildCpsAssetPageATIParams(
- payloadLegacy,
- requestContextLegacy,
- serviceContext,
- 'test-content-type',
- );
- expect(result).toEqual(expectationLegacy);
- });
-});
-
-describe('buildCpsAssetPageATIUrl', () => {
- it('should return the right url', () => {
- const result = buildCpsAssetPageATIUrl(
- payload,
- requestContext,
- serviceContext,
- 'test-content-type',
- ) as string;
-
- const params = Object.fromEntries(new URLSearchParams(result));
-
- expect(params).toEqual({
- s: '598285',
- s2: 'atiAnalyticsProducerId',
- p: 'news::pidgin.news.media_asset.49450859.page',
- r: '0x0x24x24',
- re: '1024x768',
- hl: '00-00-00',
- lng: 'en-US',
- x1: '[urn:bbc:cps:curie:asset:a753e377-f11b-5646-9c9b-4775bfa4e692]',
- x2: '[responsive]',
- x3: '[atiAnalyticsAppName]',
- x4: '[pcm]',
- x5: '[http%3A%2F%2Flocalhost%2F]',
- x7: '[test-content-type]',
- x8: '[simorgh]',
- x9: '[Nigerian%20man%20Emeka%20Nelson%20don%20produce%20generator%20wey%20dey%20use%20only%20water%20-%20Some%20BBC%20Brand]',
- x11: '[1970-01-01T00:00:00.000Z]',
- x12: '[1970-01-01T00:00:00.000Z]',
- x13: '[Technology~Nigeria]',
- x14: '[31684f19-84d6-41f6-b033-7ae08098572a~3d5d5e30-dd50-4041-96d5-c970b20005b9]',
- x16: '[WS - Inspire me~WS - Educate me~WS - Keep me on trend]',
- x17: '[News]',
- });
- });
-});
-
-describe('getProducer', () => {
- it('should return the right producer for a news asset', () => {
- const result = buildCpsAssetPageATIParams(
- payload,
- requestContext,
- newsServiceContext,
- 'test-content-type',
- );
- expect(result).toEqual(newsExpectation);
- });
-});
diff --git a/src/app/components/ATIAnalytics/params/cpsAssetPage/buildParams.ts b/src/app/components/ATIAnalytics/params/cpsAssetPage/buildParams.ts
deleted file mode 100644
index 2d769e896f6..00000000000
--- a/src/app/components/ATIAnalytics/params/cpsAssetPage/buildParams.ts
+++ /dev/null
@@ -1,86 +0,0 @@
-import path from 'ramda/src/path';
-import {
- getPublishedDatetime,
- getContentId,
- LIBRARY_VERSION,
- getThingAttributes,
-} from '../../../../lib/analyticsUtils';
-import { buildATIPageTrackPath } from '../../atiUrl';
-import { RequestContextProps } from '../../../../contexts/RequestContext';
-import { ServiceConfig } from '../../../../models/types/serviceConfig';
-import { PageData } from '../../types';
-
-export const buildCpsAssetPageATIParams = (
- pageData: PageData,
- requestContext: RequestContextProps,
- serviceContext: ServiceConfig,
- contentType: string,
-) => {
- const { platform, statsDestination } = requestContext;
- const { atiAnalyticsAppName, atiAnalyticsProducerId, service, brandName } =
- serviceContext;
-
- const { metadata, promo } = pageData;
-
- const getChapter1 = (pageIdentifier: string) => {
- if (service === 'news') {
- return metadata?.atiAnalytics?.chapter;
- }
- const chapter = pageIdentifier.split('.')[1];
- if (['media_asset', 'story'].includes(chapter)) {
- return null;
- }
- return chapter;
- };
-
- const getProducer = (defaultProducer: string) => {
- if (['news', 'sport'].includes(service)) {
- return metadata?.atiAnalytics?.producerId || defaultProducer;
- }
- return defaultProducer;
- };
-
- const page = metadata?.analyticsLabels?.counterName;
- const isValidPage = page && typeof page === 'string' && page.includes('.');
- const chapter1 = isValidPage ? getChapter1(page) : false;
- const producerId = getProducer(atiAnalyticsProducerId);
- const ldpThingIds = getThingAttributes('thingId', pageData);
- const ldpThingLabels = getThingAttributes('thingEnglishLabel', pageData);
-
- return {
- appName: atiAnalyticsAppName,
- contentId: getContentId(pageData),
- contentType,
- language: metadata?.language,
- // Example page identifier: embedded_media::pidgin.embedded_media.media_asset.49529724.page
- pageIdentifier: chapter1 ? `${chapter1}::${page}` : page,
- pageTitle: `${path(['headlines', 'headline'], promo)} - ${brandName}`,
- timePublished: getPublishedDatetime('firstPublished', pageData),
- timeUpdated: getPublishedDatetime('lastPublished', pageData),
- categoryName: metadata?.passport?.category?.categoryName,
- campaigns: metadata?.passport?.campaigns,
- ...(ldpThingIds && { ldpThingIds }),
- ...(ldpThingLabels && { ldpThingLabels }),
- producerId,
- libraryVersion: LIBRARY_VERSION,
- statsDestination,
- platform,
- service,
- };
-};
-
-export const buildCpsAssetPageATIUrl = (
- pageData: PageData,
- requestContext: RequestContextProps,
- serviceContext: ServiceConfig,
- contentType: string,
-) => {
- return buildATIPageTrackPath(
- buildCpsAssetPageATIParams(
- pageData,
- requestContext,
- serviceContext,
- contentType,
- ),
- );
-};
diff --git a/src/app/components/ATIAnalytics/params/genericPage/buildParams.test.ts b/src/app/components/ATIAnalytics/params/genericPage/buildParams.test.ts
index f1f826853b1..884c7e89017 100644
--- a/src/app/components/ATIAnalytics/params/genericPage/buildParams.test.ts
+++ b/src/app/components/ATIAnalytics/params/genericPage/buildParams.test.ts
@@ -116,6 +116,7 @@ describe('implementation of buildPageATIParams and buildPageATIUrl', () => {
const articlePageAtiData = {
categoryName: 'Refugees%20and%20asylum%20seekers~Myanmar~Military',
contentId: 'urn:bbc:optimo:asset:c9wxnzvwp3mo',
+ contentType: 'article',
language: 'my',
ldpThingIds:
'0cd55773-e753-44ad-ad07-1366bf1aa6bc~a26174f5-fa3c-4cf8-95a2-29d877175eab~ce5c43ee-8982-4f88-9472-9aa79aeb09cc',
@@ -400,4 +401,486 @@ describe('implementation of buildPageATIParams and buildPageATIUrl', () => {
expect(parsedATIURLParams).toEqual(expectedATIURLParams);
});
});
+
+ describe('CPS Page', () => {
+ describe('STY', () => {
+ const cpsSTYAtiData = {
+ campaigns: [
+ {
+ campaignId: '5a988e4739461b000e9dabfc',
+ campaignName: 'WS - Update me',
+ },
+ ],
+ categoryName: 'Explainer',
+ contentId:
+ 'urn:bbc:cps:curie:asset:3137d6de-62c2-4637-a002-29d2ab075990',
+ contentType: 'article',
+ language: 'es',
+ ldpThingIds:
+ '75612fa6-147c-4a43-97fa-fcf70d9cced3~7613abe4-1c05-4594-a5ec-3ccf6268b220~e0d04166-b92f-468e-9e68-d5f9330e6ae7',
+ ldpThingLabels: 'Politics~Nicaragua~Latin+America',
+ pageIdentifier:
+ 'latin_america::mundo.latin_america.story.64591782.page',
+ pageTitle:
+ '4 claves para entender la "sorpresiva" liberación y envío a EE.UU. de 222 opositores nicaragüenses - BBC News Mundo',
+ producerId: null,
+ producerName: 'MUNDO',
+ timePublished: '2023-02-10T02:00:41.000Z',
+ timeUpdated: '2023-02-10T02:00:41.000Z',
+ };
+
+ const validPageURLParams = {
+ appName: 'atiAnalyticsAppName',
+ campaigns: [
+ {
+ campaignId: '5a988e4739461b000e9dabfc',
+ campaignName: 'WS - Update me',
+ },
+ ],
+ categoryName: 'Explainer',
+ contentId:
+ 'urn:bbc:cps:curie:asset:3137d6de-62c2-4637-a002-29d2ab075990',
+ contentType: 'article',
+ isUK: undefined,
+ language: 'es',
+ ldpThingIds:
+ '75612fa6-147c-4a43-97fa-fcf70d9cced3~7613abe4-1c05-4594-a5ec-3ccf6268b220~e0d04166-b92f-468e-9e68-d5f9330e6ae7',
+ ldpThingLabels: 'Politics~Nicaragua~Latin+America',
+ libraryVersion: 'simorgh',
+ nationsProducer: undefined,
+ origin: undefined,
+ pageIdentifier:
+ 'latin_america::mundo.latin_america.story.64591782.page',
+ pageTitle:
+ '4 claves para entender la "sorpresiva" liberación y envío a EE.UU. de 222 opositores nicaragüenses - BBC News Mundo',
+ platform: 'canonical',
+ previousPath: undefined,
+ producerId: 'atiAnalyticsProducerId',
+ service: 'mundo',
+ statsDestination: 'statsDestination',
+ timePublished: '2023-02-10T02:00:41.000Z',
+ timeUpdated: '2023-02-10T02:00:41.000Z',
+ };
+
+ it('should return the correct object for the page given the ATI configuration', () => {
+ const result = buildPageATIParams({
+ atiData: cpsSTYAtiData,
+ requestContext,
+ serviceContext: { ...serviceContext, service: 'mundo' },
+ });
+ expect(result).toStrictEqual(validPageURLParams);
+ });
+
+ it('should use the serviceContext lang property if language is absent in atiData', () => {
+ const result = buildPageATIParams({
+ atiData: { ...cpsSTYAtiData, language: null },
+ requestContext,
+ serviceContext: { ...serviceContext, service: 'mundo', lang: 'es' },
+ });
+ expect(result).toEqual(validPageURLParams);
+ });
+
+ it('should return the correct url for a page given the ATI configuration', () => {
+ const url = buildPageATIUrl({
+ atiData: cpsSTYAtiData,
+ requestContext,
+ serviceContext,
+ });
+
+ const parsedATIURLParams = Object.fromEntries(
+ new URLSearchParams(url as string),
+ );
+
+ const expectedATIURLParams = {
+ hl: '00-00-00',
+ lng: 'en-US',
+ p: 'latin_america::mundo.latin_america.story.64591782.page',
+ r: '0x0x24x24',
+ re: '1024x768',
+ s: '598285',
+ s2: 'atiAnalyticsProducerId',
+ x1: '[urn:bbc:cps:curie:asset:3137d6de-62c2-4637-a002-29d2ab075990]',
+ x2: '[responsive]',
+ x3: '[atiAnalyticsAppName]',
+ x4: '[es]',
+ x5: '[http%3A%2F%2Flocalhost%2F]',
+ x7: '[article]',
+ x8: '[simorgh]',
+ x9: '[4%20claves%20para%20entender%20la%20"sorpresiva"%20liberación%20y%20envío%20a%20EE.UU.%20de%20222%20opositores%20nicaragüenses%20-%20BBC%20News%20Mundo]',
+ x11: '[2023-02-10T02:00:41.000Z]',
+ x12: '[2023-02-10T02:00:41.000Z]',
+ x13: '[Politics~Nicaragua~Latin+America]',
+ x14: '[75612fa6-147c-4a43-97fa-fcf70d9cced3~7613abe4-1c05-4594-a5ec-3ccf6268b220~e0d04166-b92f-468e-9e68-d5f9330e6ae7]',
+ x16: '[WS - Update me]',
+ x17: '[Explainer]',
+ };
+
+ expect(parsedATIURLParams).toEqual(expectedATIURLParams);
+ });
+ });
+
+ describe('MAP', () => {
+ const cpsMAPAtiData = {
+ campaigns: [
+ {
+ campaignId: '5a988e4739461b000e9dabfc',
+ campaignName: 'WS - Update me',
+ },
+ ],
+ categoryName: 'News',
+ contentId:
+ 'urn:bbc:cps:curie:asset:6d745333-c79d-e245-a5b2-f4acb7de35e1',
+ contentType: 'article-media-asset',
+ language: 'es',
+ ldpThingIds:
+ '75612fa6-147c-4a43-97fa-fcf70d9cced3~7613abe4-1c05-4594-a5ec-3ccf6268b220~e0d04166-b92f-468e-9e68-d5f9330e6ae7',
+ ldpThingLabels: 'Politics~Nicaragua~Latin+America',
+ pageIdentifier: 'media::mundo.media.media_asset.41174775.page',
+ pageTitle:
+ '¿Qué es el albur en México y cómo puedes saber si te están "albureando"?',
+ producerId: null,
+ producerName: 'MUNDO',
+ timePublished: '2017-09-14T14:09:14.000Z',
+ timeUpdated: '2017-09-14T14:09:14.000Z',
+ };
+
+ const validPageURLParams = {
+ appName: 'atiAnalyticsAppName',
+ campaigns: [
+ {
+ campaignId: '5a988e4739461b000e9dabfc',
+ campaignName: 'WS - Update me',
+ },
+ ],
+ categoryName: 'News',
+ contentId:
+ 'urn:bbc:cps:curie:asset:6d745333-c79d-e245-a5b2-f4acb7de35e1',
+ contentType: 'article-media-asset',
+ isUK: undefined,
+ language: 'es',
+ ldpThingIds:
+ '75612fa6-147c-4a43-97fa-fcf70d9cced3~7613abe4-1c05-4594-a5ec-3ccf6268b220~e0d04166-b92f-468e-9e68-d5f9330e6ae7',
+ ldpThingLabels: 'Politics~Nicaragua~Latin+America',
+ libraryVersion: 'simorgh',
+ nationsProducer: undefined,
+ origin: undefined,
+ pageIdentifier: 'media::mundo.media.media_asset.41174775.page',
+ pageTitle:
+ '¿Qué es el albur en México y cómo puedes saber si te están "albureando"?',
+ platform: 'canonical',
+ previousPath: undefined,
+ producerId: 'atiAnalyticsProducerId',
+ service: 'mundo',
+ statsDestination: 'statsDestination',
+ timePublished: '2017-09-14T14:09:14.000Z',
+ timeUpdated: '2017-09-14T14:09:14.000Z',
+ };
+
+ it('should return the correct object for the page given the ATI configuration', () => {
+ const result = buildPageATIParams({
+ atiData: cpsMAPAtiData,
+ requestContext,
+ serviceContext: { ...serviceContext, service: 'mundo' },
+ });
+ expect(result).toStrictEqual(validPageURLParams);
+ });
+
+ it('should use the serviceContext lang property if language is absent in atiData', () => {
+ const result = buildPageATIParams({
+ atiData: { ...cpsMAPAtiData, language: null },
+ requestContext,
+ serviceContext: { ...serviceContext, service: 'mundo', lang: 'es' },
+ });
+ expect(result).toEqual(validPageURLParams);
+ });
+
+ it('should return the correct url for a page given the ATI configuration', () => {
+ const url = buildPageATIUrl({
+ atiData: cpsMAPAtiData,
+ requestContext,
+ serviceContext,
+ });
+
+ const parsedATIURLParams = Object.fromEntries(
+ new URLSearchParams(url as string),
+ );
+
+ const expectedATIURLParams = {
+ hl: '00-00-00',
+ lng: 'en-US',
+ p: 'media::mundo.media.media_asset.41174775.page',
+ r: '0x0x24x24',
+ re: '1024x768',
+ s: '598285',
+ s2: 'atiAnalyticsProducerId',
+ x1: '[urn:bbc:cps:curie:asset:6d745333-c79d-e245-a5b2-f4acb7de35e1]',
+ x2: '[responsive]',
+ x3: '[atiAnalyticsAppName]',
+ x4: '[es]',
+ x5: '[http%3A%2F%2Flocalhost%2F]',
+ x7: '[article-media-asset]',
+ x8: '[simorgh]',
+ x9: '[¿Qué%20es%20el%20albur%20en%20México%20y%20cómo%20puedes%20saber%20si%20te%20están%20"albureando"?]',
+ x11: '[2017-09-14T14:09:14.000Z]',
+ x12: '[2017-09-14T14:09:14.000Z]',
+ x13: '[Politics~Nicaragua~Latin+America]',
+ x14: '[75612fa6-147c-4a43-97fa-fcf70d9cced3~7613abe4-1c05-4594-a5ec-3ccf6268b220~e0d04166-b92f-468e-9e68-d5f9330e6ae7]',
+ x16: '[WS - Update me]',
+ x17: '[News]',
+ };
+
+ expect(parsedATIURLParams).toEqual(expectedATIURLParams);
+ });
+ });
+
+ describe('PGL', () => {
+ const cpsPGLAtiData = {
+ campaigns: [
+ {
+ campaignId: '5a988e3139461b000e9dabf9',
+ campaignName: 'WS - Divert me',
+ },
+ ],
+ categoryName: 'News',
+ contentId:
+ 'urn:bbc:cps:curie:asset:08e22e90-7361-cd47-b586-7cb53fc5a012',
+ contentType: 'article-photo-gallery',
+ language: 'es',
+ ldpThingIds: '25844b6e-80b0-4de9-8ea0-7a35e7d4086f',
+ ldpThingLabels: 'Technology',
+ pageIdentifier: 'sport::mundo.sport.photo_gallery.36935058.page',
+ pageTitle:
+ 'Río 2016, el antes y el ahora: cómo ha cambiado la ropa deportiva en más de un siglo de juegos olímpicos',
+ producerId: null,
+ producerName: 'MUNDO',
+ timePublished: '2016-08-07T09:21:02.000Z',
+ timeUpdated: '2016-08-07T09:21:02.000Z',
+ };
+
+ const validPageURLParams = {
+ appName: 'atiAnalyticsAppName',
+ campaigns: [
+ {
+ campaignId: '5a988e3139461b000e9dabf9',
+ campaignName: 'WS - Divert me',
+ },
+ ],
+ categoryName: 'News',
+ contentId:
+ 'urn:bbc:cps:curie:asset:08e22e90-7361-cd47-b586-7cb53fc5a012',
+ contentType: 'article-photo-gallery',
+ isUK: undefined,
+ language: 'es',
+ ldpThingIds: '25844b6e-80b0-4de9-8ea0-7a35e7d4086f',
+ ldpThingLabels: 'Technology',
+ libraryVersion: 'simorgh',
+ nationsProducer: undefined,
+ origin: undefined,
+ pageIdentifier: 'sport::mundo.sport.photo_gallery.36935058.page',
+ pageTitle:
+ 'Río 2016, el antes y el ahora: cómo ha cambiado la ropa deportiva en más de un siglo de juegos olímpicos',
+ platform: 'canonical',
+ previousPath: undefined,
+ producerId: 'atiAnalyticsProducerId',
+ service: 'mundo',
+ statsDestination: 'statsDestination',
+ timePublished: '2016-08-07T09:21:02.000Z',
+ timeUpdated: '2016-08-07T09:21:02.000Z',
+ };
+
+ it('should return the correct object for the page given the ATI configuration', () => {
+ const result = buildPageATIParams({
+ atiData: cpsPGLAtiData,
+ requestContext,
+ serviceContext: { ...serviceContext, service: 'mundo' },
+ });
+ expect(result).toStrictEqual(validPageURLParams);
+ });
+
+ it('should use the serviceContext lang property if language is absent in atiData', () => {
+ const result = buildPageATIParams({
+ atiData: { ...cpsPGLAtiData, language: null },
+ requestContext,
+ serviceContext: { ...serviceContext, service: 'mundo', lang: 'es' },
+ });
+ expect(result).toEqual(validPageURLParams);
+ });
+
+ it('should return the correct url for a page given the ATI configuration', () => {
+ const url = buildPageATIUrl({
+ atiData: cpsPGLAtiData,
+ requestContext,
+ serviceContext,
+ });
+
+ const parsedATIURLParams = Object.fromEntries(
+ new URLSearchParams(url as string),
+ );
+
+ const expectedATIURLParams = {
+ hl: '00-00-00',
+ lng: 'en-US',
+ p: 'sport::mundo.sport.photo_gallery.36935058.page',
+ r: '0x0x24x24',
+ re: '1024x768',
+ s: '598285',
+ s2: 'atiAnalyticsProducerId',
+ x1: '[urn:bbc:cps:curie:asset:08e22e90-7361-cd47-b586-7cb53fc5a012]',
+ x2: '[responsive]',
+ x3: '[atiAnalyticsAppName]',
+ x4: '[es]',
+ x5: '[http%3A%2F%2Flocalhost%2F]',
+ x7: '[article-photo-gallery]',
+ x8: '[simorgh]',
+ x9: '[Río%202016,%20el%20antes%20y%20el%20ahora:%20cómo%20ha%20cambiado%20la%20ropa%20deportiva%20en%20más%20de%20un%20siglo%20de%20juegos%20olímpicos]',
+ x11: '[2016-08-07T09:21:02.000Z]',
+ x12: '[2016-08-07T09:21:02.000Z]',
+ x13: '[Technology]',
+ x14: '[25844b6e-80b0-4de9-8ea0-7a35e7d4086f]',
+ x16: '[WS - Divert me]',
+ x17: '[News]',
+ };
+
+ expect(parsedATIURLParams).toEqual(expectedATIURLParams);
+ });
+ });
+
+ describe('CSP', () => {
+ const cpsCSPAtiData = {
+ campaigns: null,
+ categoryName: 'News',
+ chapter: 'technology',
+ contentId:
+ 'urn:bbc:cps:curie:asset:c1c8b1bf-4c9c-44e8-be0d-c81a2aa59e46',
+ contentType: 'article-correspondent',
+ language: 'en-gb',
+ ldpThingIds:
+ '0d358111-576d-4d61-a7c7-e2e71931b579~2c493367-e5a2-4c19-be5f-6e9342f5c591~2f2db234-3c2d-40a4-b4ac-eea661faadd0~31684f19-84d6-41f6-b033-7ae08098572a~65ba56b4-3f50-4217-ab8e-b3c1fe890364~6892384e-1966-4c03-9ce3-f694a8f9f69e~7a48b6e0-9074-4303-ae82-011003058e16~b054a2d3-6c1e-44de-b8db-0e2501c035c0~f7bf39da-286c-4e37-8ee0-a01395f09ac2',
+ ldpThingLabels:
+ 'Intel~Technology+of+business~Business~Technology~Car+industry~China~Taiwan~Computer+chip~Semiconductors',
+ pageIdentifier:
+ 'technology::news.technology.correspondent_story.56294493.page',
+ pageTitle: "Tech Tent: The new 'space race' for computer chips",
+ producerId: '64',
+ producerName: 'NEWS',
+ timePublished: '2021-03-05T13:37:50.000Z',
+ timeUpdated: '2021-03-05T13:37:50.000Z',
+ };
+
+ const validPageURLParams = {
+ appName: 'atiAnalyticsAppName',
+ campaigns: null,
+ categoryName: 'News',
+ contentId:
+ 'urn:bbc:cps:curie:asset:c1c8b1bf-4c9c-44e8-be0d-c81a2aa59e46',
+ contentType: 'article-correspondent',
+ isUK: undefined,
+ language: 'en-gb',
+ ldpThingIds:
+ '0d358111-576d-4d61-a7c7-e2e71931b579~2c493367-e5a2-4c19-be5f-6e9342f5c591~2f2db234-3c2d-40a4-b4ac-eea661faadd0~31684f19-84d6-41f6-b033-7ae08098572a~65ba56b4-3f50-4217-ab8e-b3c1fe890364~6892384e-1966-4c03-9ce3-f694a8f9f69e~7a48b6e0-9074-4303-ae82-011003058e16~b054a2d3-6c1e-44de-b8db-0e2501c035c0~f7bf39da-286c-4e37-8ee0-a01395f09ac2',
+ ldpThingLabels:
+ 'Intel~Technology+of+business~Business~Technology~Car+industry~China~Taiwan~Computer+chip~Semiconductors',
+ libraryVersion: 'simorgh',
+ nationsProducer: undefined,
+ origin: undefined,
+ pageIdentifier:
+ 'technology::news.technology.correspondent_story.56294493.page',
+ pageTitle: "Tech Tent: The new 'space race' for computer chips",
+ platform: 'canonical',
+ previousPath: undefined,
+ producerId: '64',
+ service: 'news',
+ statsDestination: 'statsDestination',
+ timePublished: '2021-03-05T13:37:50.000Z',
+ timeUpdated: '2021-03-05T13:37:50.000Z',
+ };
+
+ it('should return the correct object for the page given the ATI configuration', () => {
+ const result = buildPageATIParams({
+ atiData: cpsCSPAtiData,
+ requestContext,
+ serviceContext: { ...serviceContext, service: 'news' },
+ });
+ expect(result).toStrictEqual(validPageURLParams);
+ });
+
+ it('should use the serviceContext lang property if language is absent in atiData', () => {
+ const result = buildPageATIParams({
+ atiData: { ...cpsCSPAtiData, language: null },
+ requestContext,
+ serviceContext: { ...serviceContext, service: 'news', lang: 'en-gb' },
+ });
+ expect(result).toEqual(validPageURLParams);
+ });
+
+ it('should use the serviceContext atiAnalyticsProducerId property if producerId is absent in atiData', () => {
+ const result = buildPageATIParams({
+ atiData: { ...cpsCSPAtiData, producerId: null },
+ requestContext,
+ serviceContext: {
+ ...serviceContext,
+ atiAnalyticsProducerId: '64',
+ service: 'news',
+ lang: 'en-gb',
+ },
+ });
+ expect(result).toEqual(validPageURLParams);
+ });
+
+ it('should use the set producerId in atiData in favour of the serviceContext atiAnalyticsProducerId poperty', () => {
+ const result = buildPageATIParams({
+ atiData: { ...cpsCSPAtiData, producerId: 'overrideProducerId' },
+ requestContext,
+ serviceContext: {
+ ...serviceContext,
+ atiAnalyticsProducerId: '64',
+ service: 'news',
+ lang: 'en-gb',
+ },
+ });
+ const expectedParamsWithOverride = {
+ ...validPageURLParams,
+ producerId: 'overrideProducerId',
+ };
+ expect(result).toEqual(expectedParamsWithOverride);
+ });
+
+ it('should return the correct url for a page given the ATI configuration', () => {
+ const url = buildPageATIUrl({
+ atiData: cpsCSPAtiData,
+ requestContext,
+ serviceContext,
+ });
+
+ const parsedATIURLParams = Object.fromEntries(
+ new URLSearchParams(url as string),
+ );
+
+ const expectedATIURLParams = {
+ hl: '00-00-00',
+ lng: 'en-US',
+ p: 'technology::news.technology.correspondent_story.56294493.page',
+ r: '0x0x24x24',
+ re: '1024x768',
+ s: '598285',
+ s2: '64',
+ x1: '[urn:bbc:cps:curie:asset:c1c8b1bf-4c9c-44e8-be0d-c81a2aa59e46]',
+ x2: '[responsive]',
+ x3: '[atiAnalyticsAppName]',
+ x4: '[en-gb]',
+ x5: '[http%3A%2F%2Flocalhost%2F]',
+ x7: '[article-correspondent]',
+ x8: '[simorgh]',
+ x9: "[Tech%20Tent:%20The%20new%20'space%20race'%20for%20computer%20chips]",
+ x11: '[2021-03-05T13:37:50.000Z]',
+ x12: '[2021-03-05T13:37:50.000Z]',
+ x13: '[Intel~Technology+of+business~Business~Technology~Car+industry~China~Taiwan~Computer+chip~Semiconductors]',
+ x14: '[0d358111-576d-4d61-a7c7-e2e71931b579~2c493367-e5a2-4c19-be5f-6e9342f5c591~2f2db234-3c2d-40a4-b4ac-eea661faadd0~31684f19-84d6-41f6-b033-7ae08098572a~65ba56b4-3f50-4217-ab8e-b3c1fe890364~6892384e-1966-4c03-9ce3-f694a8f9f69e~7a48b6e0-9074-4303-ae82-011003058e16~b054a2d3-6c1e-44de-b8db-0e2501c035c0~f7bf39da-286c-4e37-8ee0-a01395f09ac2]',
+ x17: '[News]',
+ };
+
+ expect(parsedATIURLParams).toEqual(expectedATIURLParams);
+ });
+ });
+ });
});
diff --git a/src/app/components/ATIAnalytics/params/genericPage/buildParams.ts b/src/app/components/ATIAnalytics/params/genericPage/buildParams.ts
index 90aa498d10a..1c0cf86f44d 100644
--- a/src/app/components/ATIAnalytics/params/genericPage/buildParams.ts
+++ b/src/app/components/ATIAnalytics/params/genericPage/buildParams.ts
@@ -7,11 +7,12 @@ export const buildPageATIParams = ({
requestContext,
serviceContext,
}: ATIDataWithContexts) => {
- const { isUK, origin, pageType, platform, previousPath, statsDestination } =
+ const { isUK, origin, platform, previousPath, statsDestination } =
requestContext;
const { atiAnalyticsAppName, atiAnalyticsProducerId, lang, service } =
serviceContext;
const {
+ campaigns,
categoryName,
contentId,
contentType,
@@ -21,15 +22,17 @@ export const buildPageATIParams = ({
nationsProducer,
pageIdentifier,
pageTitle,
+ producerId,
timePublished,
timeUpdated,
} = atiData;
return {
appName: atiAnalyticsAppName,
+ campaigns,
categoryName,
contentId,
- contentType: contentType || pageType,
+ contentType,
isUK,
language: language || lang,
ldpThingIds,
@@ -41,7 +44,7 @@ export const buildPageATIParams = ({
pageTitle,
platform,
previousPath,
- producerId: atiAnalyticsProducerId,
+ producerId: producerId || atiAnalyticsProducerId,
service,
statsDestination,
timePublished,
diff --git a/src/app/components/ATIAnalytics/params/index.test.ts b/src/app/components/ATIAnalytics/params/index.test.ts
index 59d7d79f1ef..7f5cba103c7 100644
--- a/src/app/components/ATIAnalytics/params/index.test.ts
+++ b/src/app/components/ATIAnalytics/params/index.test.ts
@@ -103,66 +103,6 @@ const media: PageData = {
contentType: 'player-live',
};
-const MAP: PageData = {
- promo: {
- headlines: {
- headline: 'headline',
- },
- },
- metadata: {
- id: 'id',
- language: 'language',
- analyticsLabels: {
- counterName: 'pageIdentifier',
- pageIdentifier: 'pageIdentifier',
- pageTitle: 'pageTitle',
- contentId: 'urn:bbc:cps:4d36f80b-8711-0b4e-8da0-ef76ae8ac470',
- },
- firstPublished: 1566574729,
- lastPublished: 1566577208,
- locators: {
- curie: 'http://www.bbc.co.uk/asset/4d36f80b-8711-0b4e-8da0-ef76ae8ac470',
- },
- passport: {
- category: {
- categoryId:
- 'http://www.bbc.co.uk/ontologies/applicationlogic-news/News',
- categoryName: 'News',
- },
- campaigns: [
- {
- campaignId: '5a988e2139461b000e9dabf7',
- campaignName: 'WS - Inspire me',
- },
- ],
- },
- },
-};
-
-const PGL: PageData = {
- promo: {
- headlines: {
- headline: 'headline',
- },
- },
- metadata: {
- id: 'id',
- language: 'language',
- analyticsLabels: {
- counterName: 'pageIdentifier',
- pageIdentifier: 'pageIdentifier',
- pageTitle: 'pageTitle',
- contentId: 'urn:bbc:cps:4d36f80b-8711-0b4e-8da0-ef76ae8ac470',
- },
- firstPublished: 1566574729,
- lastPublished: 1566577208,
- locators: {
- curie: 'http://www.bbc.co.uk/asset/4d36f80b-8711-0b4e-8da0-ef76ae8ac470',
- },
- passport: {},
- },
-};
-
const idxPage: PageData = {
metadata: {
analyticsLabels: {
@@ -187,6 +127,7 @@ const homePageAnalyticsData: ATIData = {
const articlePageAnalyticsData: ATIData = {
categoryName: 'Nigeria~Education~Lagos%20state~Women',
contentId: 'urn:bbc:optimo:asset:crgrx86em6yo',
+ contentType: 'article',
language: 'pcm',
ldpThingIds:
'3d5d5e30-dd50-4041-96d5-c970b20005b9~6942cb29-9d3f-4c9c-9806-0a0578c286d6~d651d520-a675-4911-8832-1596f257000b~e45cb5f8-3c87-4ebd-ac1c-058e9be22862',
@@ -199,12 +140,56 @@ const articlePageAnalyticsData: ATIData = {
timeUpdated: '2023-07-19T15:57:54.500Z',
};
+const cpsMAPPageAnalyticsData: ATIData = {
+ campaigns: [
+ {
+ campaignId: '5a988e4739461b000e9dabfc',
+ campaignName: 'WS - Update me',
+ },
+ ],
+ categoryName: 'News',
+ contentId: 'urn:bbc:cps:4d36f80b-8711-0b4e-8da0-ef76ae8ac470',
+ contentType: 'article-media-asset',
+ language: 'es',
+ ldpThingIds:
+ '75612fa6-147c-4a43-97fa-fcf70d9cced3~7613abe4-1c05-4594-a5ec-3ccf6268b220~e0d04166-b92f-468e-9e68-d5f9330e6ae7',
+ ldpThingLabels: 'Politics~Nicaragua~Latin+America',
+ pageIdentifier: 'media::mundo.media.media_asset.41174775.page',
+ pageTitle:
+ '¿Qué es el albur en México y cómo puedes saber si te están "albureando"? - BBC News Mundo',
+ producerId: null,
+ producerName: 'MUNDO',
+ timePublished: '2017-09-14T14:09:14.000Z',
+ timeUpdated: '2017-09-14T14:09:14.000Z',
+};
+
+const cpsPGLPageAnalyticsData: ATIData = {
+ campaigns: [
+ {
+ campaignId: '5a988e3139461b000e9dabf9',
+ campaignName: 'WS - Divert me',
+ },
+ ],
+ categoryName: 'News',
+ contentId: 'urn:bbc:cps:curie:asset:08e22e90-7361-cd47-b586-7cb53fc5a012',
+ contentType: 'article-photo-gallery',
+ language: 'es',
+ ldpThingIds: '25844b6e-80b0-4de9-8ea0-7a35e7d4086f',
+ ldpThingLabels: 'Technology',
+ pageIdentifier: 'sport::mundo.sport.photo_gallery.36935058.page',
+ pageTitle:
+ 'Río 2016, el antes y el ahora: cómo ha cambiado la ropa deportiva en más de un siglo de juegos olímpicos - BBC News Mundo',
+ producerId: null,
+ producerName: 'MUNDO',
+ timePublished: '2016-08-07T09:21:02.000Z',
+ timeUpdated: '2016-08-07T09:21:02.000Z',
+};
+
describe('ATIAnalytics params', () => {
describe('buildATIUrl', () => {
it('should return the correct article url', () => {
const url = buildATIUrl({
requestContext: { ...requestContext, pageType: ARTICLE_PAGE },
- data: article,
atiData: articlePageAnalyticsData,
serviceContext,
});
@@ -377,67 +362,81 @@ describe('ATIAnalytics params', () => {
it('should return the correct MAP url', () => {
const url = buildATIUrl({
requestContext: { ...requestContext, pageType: MEDIA_ASSET_PAGE },
- data: MAP,
+ atiData: cpsMAPPageAnalyticsData,
serviceContext,
});
- const parsedATIParams = Object.fromEntries(
+ const parsedATIURLParams = Object.fromEntries(
new URLSearchParams(url as string),
);
- expect(parsedATIParams).toEqual({
- s: '598285',
- s2: 'atiAnalyticsProducerId',
- p: 'pageIdentifier',
- r: '0x0x24x24',
- re: '1024x768',
+ const expectedATIURLParams = {
hl: '00-00-00',
lng: 'en-US',
+ p: 'media::mundo.media.media_asset.41174775.page',
+ r: '0x0x24x24',
+ re: '1024x768',
+ ref: 'originhttp://www.example.com',
+ s: '598285',
+ s2: 'atiAnalyticsProducerId',
x1: '[urn:bbc:cps:4d36f80b-8711-0b4e-8da0-ef76ae8ac470]',
x2: '[responsive]',
x3: '[atiAnalyticsAppName]',
- x4: '[language]',
+ x4: '[es]',
x5: '[http%3A%2F%2Flocalhost%2F]',
+ x6: '[originhttp%3A%2F%2Fwww.example.com]',
x7: '[article-media-asset]',
x8: '[simorgh]',
- x9: '[headline%20-%20brandName]',
- x11: '[1970-01-01T00:00:00.000Z]',
- x12: '[1970-01-01T00:00:00.000Z]',
- x16: '[WS - Inspire me]',
+ x9: '[¿Qué%20es%20el%20albur%20en%20México%20y%20cómo%20puedes%20saber%20si%20te%20están%20"albureando"?%20-%20BBC%20News%20Mundo]',
+ x11: '[2017-09-14T14:09:14.000Z]',
+ x12: '[2017-09-14T14:09:14.000Z]',
+ x13: '[Politics~Nicaragua~Latin+America]',
+ x14: '[75612fa6-147c-4a43-97fa-fcf70d9cced3~7613abe4-1c05-4594-a5ec-3ccf6268b220~e0d04166-b92f-468e-9e68-d5f9330e6ae7]',
+ x16: '[WS - Update me]',
x17: '[News]',
- });
+ };
+
+ expect(parsedATIURLParams).toEqual(expectedATIURLParams);
});
it('should return the correct PGL url', () => {
const url = buildATIUrl({
requestContext: { ...requestContext, pageType: PHOTO_GALLERY_PAGE },
- data: PGL,
+ atiData: cpsPGLPageAnalyticsData,
serviceContext,
});
- const parsedATIParams = Object.fromEntries(
+ const parsedATIURLParams = Object.fromEntries(
new URLSearchParams(url as string),
);
- expect(parsedATIParams).toEqual({
- s: '598285',
- s2: 'atiAnalyticsProducerId',
- p: 'pageIdentifier',
- r: '0x0x24x24',
- re: '1024x768',
+ const expectedATIURLParams = {
hl: '00-00-00',
lng: 'en-US',
- x1: '[urn:bbc:cps:4d36f80b-8711-0b4e-8da0-ef76ae8ac470]',
+ p: 'sport::mundo.sport.photo_gallery.36935058.page',
+ r: '0x0x24x24',
+ re: '1024x768',
+ ref: 'originhttp://www.example.com',
+ s: '598285',
+ s2: 'atiAnalyticsProducerId',
+ x1: '[urn:bbc:cps:curie:asset:08e22e90-7361-cd47-b586-7cb53fc5a012]',
x2: '[responsive]',
x3: '[atiAnalyticsAppName]',
- x4: '[language]',
+ x4: '[es]',
x5: '[http%3A%2F%2Flocalhost%2F]',
+ x6: '[originhttp%3A%2F%2Fwww.example.com]',
x7: '[article-photo-gallery]',
x8: '[simorgh]',
- x9: '[headline%20-%20brandName]',
- x11: '[1970-01-01T00:00:00.000Z]',
- x12: '[1970-01-01T00:00:00.000Z]',
- });
+ x9: '[Río%202016,%20el%20antes%20y%20el%20ahora:%20cómo%20ha%20cambiado%20la%20ropa%20deportiva%20en%20más%20de%20un%20siglo%20de%20juegos%20olímpicos%20-%20BBC%20News%20Mundo]',
+ x11: '[2016-08-07T09:21:02.000Z]',
+ x12: '[2016-08-07T09:21:02.000Z]',
+ x13: '[Technology]',
+ x14: '[25844b6e-80b0-4de9-8ea0-7a35e7d4086f]',
+ x16: '[WS - Divert me]',
+ x17: '[News]',
+ };
+
+ expect(parsedATIURLParams).toEqual(expectedATIURLParams);
});
it('should return the correct Homepage url', () => {
@@ -475,7 +474,6 @@ describe('ATIAnalytics params', () => {
it('should have both ref parameter and x6 referrer url parameter, if referrer url exists', () => {
const atiUrl = buildATIUrl({
requestContext: { ...requestContext, pageType: ARTICLE_PAGE },
- data: article,
serviceContext,
atiData: articlePageAnalyticsData,
}) as string;
@@ -489,7 +487,6 @@ describe('ATIAnalytics params', () => {
it('should have ref parameter as the last parameter, if referrer url exists', () => {
const atiUrl = buildATIUrl({
requestContext: { ...requestContext, pageType: ARTICLE_PAGE },
- data: article,
serviceContext,
atiData: articlePageAnalyticsData,
}) as string;
@@ -505,7 +502,6 @@ describe('ATIAnalytics params', () => {
pageType: ARTICLE_PAGE,
previousPath: '',
},
- data: article,
serviceContext,
atiData: articlePageAnalyticsData,
}) as string;
@@ -545,7 +541,7 @@ describe('ATIAnalytics params', () => {
it('should not invoke buildPageATIUrl for an unsupported page types', () => {
buildATIUrl({
- requestContext: { ...requestContext, pageType: MEDIA_ASSET_PAGE },
+ requestContext: { ...requestContext, pageType: MEDIA_PAGE },
atiData: homePageAnalyticsData,
serviceContext,
});
@@ -571,7 +567,6 @@ describe('ATIAnalytics params', () => {
it('should return the correct article params', () => {
const params = buildATIEventTrackingParams({
requestContext: { ...requestContext, pageType: ARTICLE_PAGE },
- data: article,
atiData: articlePageAnalyticsData,
serviceContext,
});
@@ -702,7 +697,7 @@ describe('ATIAnalytics params', () => {
it('should return the correct MAP params', () => {
const params = buildATIEventTrackingParams({
requestContext: { ...requestContext, pageType: MEDIA_ASSET_PAGE },
- data: MAP,
+ atiData: cpsMAPPageAnalyticsData,
serviceContext,
});
expect(params).toEqual({
@@ -710,47 +705,68 @@ describe('ATIAnalytics params', () => {
categoryName: 'News',
campaigns: [
{
- campaignId: '5a988e2139461b000e9dabf7',
- campaignName: 'WS - Inspire me',
+ campaignId: '5a988e4739461b000e9dabfc',
+ campaignName: 'WS - Update me',
},
],
contentId: 'urn:bbc:cps:4d36f80b-8711-0b4e-8da0-ef76ae8ac470',
contentType: 'article-media-asset',
- language: 'language',
- pageIdentifier: 'pageIdentifier',
- pageTitle: 'headline - brandName',
+ isUK: false,
+ language: 'es',
+ ldpThingIds:
+ '75612fa6-147c-4a43-97fa-fcf70d9cced3~7613abe4-1c05-4594-a5ec-3ccf6268b220~e0d04166-b92f-468e-9e68-d5f9330e6ae7',
+ ldpThingLabels: 'Politics~Nicaragua~Latin+America',
libraryVersion: 'simorgh',
+ nationsProducer: undefined,
+ origin: 'origin',
+ pageIdentifier: 'media::mundo.media.media_asset.41174775.page',
+ pageTitle:
+ '¿Qué es el albur en México y cómo puedes saber si te están "albureando"? - BBC News Mundo',
platform: 'canonical',
+ previousPath: 'http://www.example.com',
producerId: 'atiAnalyticsProducerId',
service: 'pidgin',
statsDestination: 'statsDestination',
- timePublished: '1970-01-01T00:00:00.000Z',
- timeUpdated: '1970-01-01T00:00:00.000Z',
+ timePublished: '2017-09-14T14:09:14.000Z',
+ timeUpdated: '2017-09-14T14:09:14.000Z',
});
});
it('should return the correct PGL params', () => {
const params = buildATIEventTrackingParams({
requestContext: { ...requestContext, pageType: PHOTO_GALLERY_PAGE },
- data: PGL,
+ atiData: cpsPGLPageAnalyticsData,
serviceContext,
});
expect(params).toEqual({
appName: 'atiAnalyticsAppName',
- categoryName: undefined,
- campaigns: undefined,
- contentId: 'urn:bbc:cps:4d36f80b-8711-0b4e-8da0-ef76ae8ac470',
+ campaigns: [
+ {
+ campaignId: '5a988e3139461b000e9dabf9',
+ campaignName: 'WS - Divert me',
+ },
+ ],
+ categoryName: 'News',
+ contentId:
+ 'urn:bbc:cps:curie:asset:08e22e90-7361-cd47-b586-7cb53fc5a012',
contentType: 'article-photo-gallery',
- language: 'language',
- pageIdentifier: 'pageIdentifier',
- pageTitle: 'headline - brandName',
+ isUK: false,
+ language: 'es',
+ ldpThingIds: '25844b6e-80b0-4de9-8ea0-7a35e7d4086f',
+ ldpThingLabels: 'Technology',
libraryVersion: 'simorgh',
+ nationsProducer: undefined,
+ origin: 'origin',
+ pageIdentifier: 'sport::mundo.sport.photo_gallery.36935058.page',
+ pageTitle:
+ 'Río 2016, el antes y el ahora: cómo ha cambiado la ropa deportiva en más de un siglo de juegos olímpicos - BBC News Mundo',
platform: 'canonical',
+ previousPath: 'http://www.example.com',
producerId: 'atiAnalyticsProducerId',
service: 'pidgin',
statsDestination: 'statsDestination',
- timePublished: '1970-01-01T00:00:00.000Z',
- timeUpdated: '1970-01-01T00:00:00.000Z',
+ timePublished: '2016-08-07T09:21:02.000Z',
+ timeUpdated: '2016-08-07T09:21:02.000Z',
});
});
@@ -815,7 +831,7 @@ describe('ATIAnalytics params', () => {
it('should not invoke buildPageATIParams for an unsupported page types', () => {
buildATIEventTrackingParams({
- requestContext: { ...requestContext, pageType: MEDIA_ASSET_PAGE },
+ requestContext: { ...requestContext, pageType: MEDIA_PAGE },
atiData: homePageAnalyticsData,
serviceContext,
});
@@ -843,7 +859,7 @@ describe('ATIAnalytics params', () => {
const pageData = null;
const params = buildATIEventTrackingParams({
- requestContext: { ...requestContext, pageType: PHOTO_GALLERY_PAGE },
+ requestContext: { ...requestContext, pageType: MEDIA_PAGE },
// @ts-expect-error - pass in null value to ensure error handling working as expected
data: pageData,
serviceContext,
@@ -857,5 +873,26 @@ describe('ATIAnalytics params', () => {
);
console.error = error;
});
+
+ it('should not throw exception and return empty object if no atiData is passed in', () => {
+ const { error } = console;
+ console.error = jest.fn();
+
+ const atiData = null;
+ const params = buildATIEventTrackingParams({
+ requestContext: { ...requestContext, pageType: MEDIA_PAGE },
+ // @ts-expect-error - pass in null value to ensure error handling working as expected
+ atiData,
+ serviceContext,
+ });
+
+ expect(params).toEqual({});
+ expect(console.error).toHaveBeenCalledWith(
+ expect.stringContaining(
+ 'ATI Event Tracking Error: Could not parse tracking values from page data:',
+ ),
+ );
+ console.error = error;
+ });
});
});
diff --git a/src/app/components/ATIAnalytics/params/index.ts b/src/app/components/ATIAnalytics/params/index.ts
index b676553fa74..08fc2a9be84 100644
--- a/src/app/components/ATIAnalytics/params/index.ts
+++ b/src/app/components/ATIAnalytics/params/index.ts
@@ -24,10 +24,6 @@ import {
buildTvRadioATIParams,
buildTvRadioATIUrl,
} from './tvRadioPage/buildParams';
-import {
- buildCpsAssetPageATIParams,
- buildCpsAssetPageATIUrl,
-} from './cpsAssetPage/buildParams';
import { buildPageATIUrl, buildPageATIParams } from './genericPage/buildParams';
import {
buildMostWatchedATIParams,
@@ -46,9 +42,6 @@ import {
} from '../types';
import { PageTypes } from '../../../models/types/global';
-const ARTICLE_MEDIA_ASSET = 'article-media-asset';
-const ARTICLE_PHOTO_GALLERY = 'article-photo-gallery';
-const ARTICLE_CORRESPONDENT_PIECE = 'article-correspondent';
const ARTICLE_SHORT_FORM_VIDEO = 'article-sfv';
const MIGRATED_PAGE_TYPES: PageTypes[] = [
@@ -56,6 +49,10 @@ const MIGRATED_PAGE_TYPES: PageTypes[] = [
ARTICLE_PAGE,
TOPIC_PAGE,
MOST_READ_PAGE,
+ STORY_PAGE,
+ PHOTO_GALLERY_PAGE,
+ MEDIA_ASSET_PAGE,
+ CORRESPONDENT_STORY_PAGE,
];
const noOp = () => {
@@ -75,12 +72,7 @@ const pageTypeUrlBuilders = {
serviceContext,
ARTICLE_SHORT_FORM_VIDEO,
),
- [STORY_PAGE]: (
- data: PageData,
- requestContext: RequestContextProps,
- serviceContext: ServiceConfig,
- ) =>
- buildCpsAssetPageATIUrl(data, requestContext, serviceContext, ARTICLE_PAGE),
+ [STORY_PAGE]: noOp,
[FRONT_PAGE]: buildIndexPageATIUrl,
[MEDIA_PAGE]: buildTvRadioATIUrl,
[MOST_READ_PAGE]: noOp,
@@ -88,39 +80,9 @@ const pageTypeUrlBuilders = {
[INDEX_PAGE]: buildIndexPageATIUrl,
[FEATURE_INDEX_PAGE]: buildIndexPageATIUrl,
[TOPIC_PAGE]: noOp,
- [MEDIA_ASSET_PAGE]: (
- data: PageData,
- requestContext: RequestContextProps,
- serviceContext: ServiceConfig,
- ) =>
- buildCpsAssetPageATIUrl(
- data,
- requestContext,
- serviceContext,
- ARTICLE_MEDIA_ASSET,
- ),
- [PHOTO_GALLERY_PAGE]: (
- data: PageData,
- requestContext: RequestContextProps,
- serviceContext: ServiceConfig,
- ) =>
- buildCpsAssetPageATIUrl(
- data,
- requestContext,
- serviceContext,
- ARTICLE_PHOTO_GALLERY,
- ),
- [CORRESPONDENT_STORY_PAGE]: (
- data: PageData,
- requestContext: RequestContextProps,
- serviceContext: ServiceConfig,
- ) =>
- buildCpsAssetPageATIUrl(
- data,
- requestContext,
- serviceContext,
- ARTICLE_CORRESPONDENT_PIECE,
- ),
+ [MEDIA_ASSET_PAGE]: noOp,
+ [PHOTO_GALLERY_PAGE]: noOp,
+ [CORRESPONDENT_STORY_PAGE]: noOp,
[HOME_PAGE]: noOp,
[ERROR_PAGE]: noOp,
[LIVE_PAGE]: noOp,
@@ -141,45 +103,10 @@ const pageTypeParamBuilders = {
[INDEX_PAGE]: buildIndexPageATIParams,
[FEATURE_INDEX_PAGE]: buildIndexPageATIParams,
[TOPIC_PAGE]: noOp,
- [MEDIA_ASSET_PAGE]: (
- data: PageData,
- requestContext: RequestContextProps,
- serviceContext: ServiceConfig,
- ) =>
- buildCpsAssetPageATIParams(
- data,
- requestContext,
- serviceContext,
- ARTICLE_MEDIA_ASSET,
- ),
- [PHOTO_GALLERY_PAGE]: (
- data: PageData,
- requestContext: RequestContextProps,
- serviceContext: ServiceConfig,
- ) =>
- buildCpsAssetPageATIParams(
- data,
- requestContext,
- serviceContext,
- ARTICLE_PHOTO_GALLERY,
- ),
- [CORRESPONDENT_STORY_PAGE]: (
- data: PageData,
- requestContext: RequestContextProps,
- serviceContext: ServiceConfig,
- ) =>
- buildCpsAssetPageATIParams(
- data,
- requestContext,
- serviceContext,
- ARTICLE_CORRESPONDENT_PIECE,
- ),
- [STORY_PAGE]: (
- data: PageData,
- requestContext: RequestContextProps,
- serviceContext: ServiceConfig,
- ) =>
- buildCpsAssetPageATIParams(data, requestContext, serviceContext, 'article'),
+ [MEDIA_ASSET_PAGE]: noOp,
+ [PHOTO_GALLERY_PAGE]: noOp,
+ [CORRESPONDENT_STORY_PAGE]: noOp,
+ [STORY_PAGE]: noOp,
[HOME_PAGE]: noOp,
[ERROR_PAGE]: noOp,
[LIVE_PAGE]: noOp,
diff --git a/src/app/components/ATIAnalytics/types.ts b/src/app/components/ATIAnalytics/types.ts
index 6fe22b62436..7dc142c0cac 100644
--- a/src/app/components/ATIAnalytics/types.ts
+++ b/src/app/components/ATIAnalytics/types.ts
@@ -64,6 +64,7 @@ export interface PageData {
}
export interface ATIData {
+ campaigns?: { campaignId?: string; campaignName?: string }[] | null;
categoryName?: string | null;
contentId?: string | null;
contentType?: string;
@@ -73,6 +74,8 @@ export interface ATIData {
nationsProducer?: string | null;
pageIdentifier?: string;
pageTitle?: string | null;
+ producerId?: string | null;
+ producerName?: string | null;
timePublished?: string | null;
timeUpdated?: string | null;
}
@@ -127,7 +130,7 @@ export interface ATIPageTrackingProps {
origin?: string;
previousPath?: string | null;
categoryName?: string | null;
- campaigns?: { campaignId?: string; campaignName?: string }[];
+ campaigns?: { campaignId?: string; campaignName?: string }[] | null;
nationsProducer?: string | null;
}
diff --git a/src/app/components/react-testing-library-with-providers.tsx b/src/app/components/react-testing-library-with-providers.tsx
index 19ca5229451..c239f107470 100644
--- a/src/app/components/react-testing-library-with-providers.tsx
+++ b/src/app/components/react-testing-library-with-providers.tsx
@@ -13,6 +13,7 @@ jest.mock('./ThemeProvider');
interface Props {
children: JSX.Element | JSX.Element[];
+ id?: string | null;
isAmp?: boolean;
isApp?: boolean;
pageData?: object;
@@ -22,12 +23,14 @@ interface Props {
pageIdentifier?: string;
pageTitle?: string;
};
+ bbcOrigin?: string | null;
pageType?: PageTypes;
derivedPageType?: string | null;
pathname?: string;
service?: Services;
toggles?: Toggles;
showAdsBasedOnLocation?: boolean;
+ statusCode?: number | null;
variant?: Variants;
isNextJs?: boolean;
pageLang?: string;
@@ -37,8 +40,10 @@ const AllTheProviders: FC = ({
children,
pageData,
atiData,
+ id = null,
isAmp = false,
isApp = false,
+ bbcOrigin = 'https://www.test.bbc.com',
pageType = 'article',
derivedPageType,
pathname = '/news/articles/c0g992jmmkko',
@@ -47,6 +52,7 @@ const AllTheProviders: FC = ({
variant = 'default',
pageLang = undefined,
showAdsBasedOnLocation = false,
+ statusCode = null,
isNextJs = false,
}: Props) => {
return (
@@ -57,7 +63,8 @@ const AllTheProviders: FC = ({
pageLang={pageLang}
>
= ({
pathname={pathname}
derivedPageType={derivedPageType}
showAdsBasedOnLocation={showAdsBasedOnLocation}
+ statusCode={statusCode}
>
@@ -85,8 +93,10 @@ const customRender = (
options?: Omit & Omit,
) => {
const {
+ id,
isAmp,
isApp,
+ bbcOrigin,
pageData,
pageType,
atiData,
@@ -96,6 +106,7 @@ const customRender = (
toggles,
variant,
showAdsBasedOnLocation,
+ statusCode,
isNextJs,
pageLang,
} = options || {};
@@ -103,8 +114,10 @@ const customRender = (
return render(ui, {
wrapper: ({ children }) => (
@@ -125,4 +139,4 @@ const customRender = (
};
export * from '@testing-library/react';
-export { customRender as render };
+export { customRender as render, AllTheProviders };
diff --git a/src/app/contexts/EventTrackingContext/fixtureData.json b/src/app/contexts/EventTrackingContext/fixtureData.json
index 3214ba90be9..37d9db97433 100644
--- a/src/app/contexts/EventTrackingContext/fixtureData.json
+++ b/src/app/contexts/EventTrackingContext/fixtureData.json
@@ -8,12 +8,37 @@
"cps_asset_id": "51745682",
"cps_asset_type": "sty"
},
+ "atiAnalytics": {
+ "campaigns": [
+ {
+ "campaignId": "5a988e3e39461b000e9dabfb",
+ "campaignName": "WS - Keep me on trend"
+ },
+ {
+ "campaignId": "5a988e4739461b000e9dabfc",
+ "campaignName": "WS - Update me"
+ }
+ ],
+ "categoryName": "News",
+ "contentId": "urn:bbc:cps:curie:asset:53870d86-88c5-6f4d-a260-f97c68606458",
+ "contentType": "article",
+ "language": "pcm",
+ "ldpThingIds": "3d5d5e30-dd50-4041-96d5-c970b20005b9~7d65828a-85c1-41f4-96cf-c758da75e401",
+ "ldpThingLabels": null,
+ "pageIdentifier": "news::pidgin.news.story.51745682.page",
+ "pageTitle": "Adams Oshiomhole say 'I still be APC National Chairman'",
+ "producerId": null,
+ "timePublished": "2020-03-04T18:58:43.000Z",
+ "timeUpdated": "2020-03-04T19:26:11.000Z",
+ "producerName": "PIDGIN"
+ },
"blockTypes": ["image", "paragraph", "list", "crosshead"],
"createdBy": "pidgin-v6",
"id": "urn:bbc:ares::asset:pidgin/tori-51745682",
"includeComments": false,
"language": "pcm",
"locators": {
+ "ldp_ids": "3d5d5e30-dd50-4041-96d5-c970b20005b9~7d65828a-85c1-41f4-96cf-c758da75e401",
"assetId": "51745682",
"assetUri": "/pidgin/tori-51745682",
"cpsUrn": "urn:bbc:content:assetUri:pidgin/tori-51745682",
diff --git a/src/app/contexts/EventTrackingContext/index.test.tsx b/src/app/contexts/EventTrackingContext/index.test.tsx
index dfb1c7cfb8e..a2eeb7eea35 100644
--- a/src/app/contexts/EventTrackingContext/index.test.tsx
+++ b/src/app/contexts/EventTrackingContext/index.test.tsx
@@ -41,8 +41,13 @@ const TestComponent = () => {
describe('Expected use', () => {
it('should provide tracking data to all child components', () => {
+ const {
+ metadata: { atiAnalytics },
+ } = fixtureData;
+
render(, {
pageData: fixtureData,
+ atiData: atiAnalytics,
service: 'pidgin',
toggles: defaultToggles,
pageType: STORY_PAGE,
diff --git a/src/app/hooks/useClickTrackerHandler/fixtureData/tori-51745682.json b/src/app/hooks/useClickTrackerHandler/fixtureData/tori-51745682.json
index df0f9398f49..b9a6a0e4e1b 100644
--- a/src/app/hooks/useClickTrackerHandler/fixtureData/tori-51745682.json
+++ b/src/app/hooks/useClickTrackerHandler/fixtureData/tori-51745682.json
@@ -200,6 +200,30 @@
"cps_asset_id": "51745682",
"cps_asset_type": "sty"
},
+ "atiAnalytics": {
+ "campaigns": [
+ {
+ "campaignId": "5a988e3e39461b000e9dabfb",
+ "campaignName": "WS - Keep me on trend"
+ },
+ {
+ "campaignId": "5a988e4739461b000e9dabfc",
+ "campaignName": "WS - Update me"
+ }
+ ],
+ "categoryName": "News",
+ "contentId": "urn:bbc:cps:curie:asset:53870d86-88c5-6f4d-a260-f97c68606458",
+ "contentType": "article",
+ "language": "pcm",
+ "ldpThingIds": "3d5d5e30-dd50-4041-96d5-c970b20005b9~7d65828a-85c1-41f4-96cf-c758da75e401",
+ "ldpThingLabels": null,
+ "pageIdentifier": "news::pidgin.news.story.51745682.page",
+ "pageTitle": "Adams Oshiomhole say 'I still be APC National Chairman'",
+ "producerId": null,
+ "timePublished": "2020-03-04T18:58:43.000Z",
+ "timeUpdated": "2020-03-04T19:26:11.000Z",
+ "producerName": "PIDGIN"
+ },
"blockTypes": ["image", "paragraph", "list", "crosshead"],
"createdBy": "pidgin-v6",
"firstPublished": 1583348323000,
@@ -210,6 +234,7 @@
"lastUpdated": 1583350085159,
"locators": {
"assetId": "51745682",
+ "ldp_ids": "3d5d5e30-dd50-4041-96d5-c970b20005b9~7d65828a-85c1-41f4-96cf-c758da75e401",
"assetUri": "/pidgin/tori-51745682",
"cpsUrn": "urn:bbc:content:assetUri:pidgin/tori-51745682",
"curie": "http://www.bbc.co.uk/asset/53870d86-88c5-6f4d-a260-f97c68606458"
diff --git a/src/app/hooks/useClickTrackerHandler/index.test.jsx b/src/app/hooks/useClickTrackerHandler/index.test.jsx
index e2209b4905f..ee5cb890ecc 100644
--- a/src/app/hooks/useClickTrackerHandler/index.test.jsx
+++ b/src/app/hooks/useClickTrackerHandler/index.test.jsx
@@ -2,17 +2,18 @@
/* eslint-disable jsx-a11y/no-static-element-interactions */
/* eslint-disable react/prop-types */
import React from 'react';
-import { renderHook } from '@testing-library/react-hooks';
-import { render, act, fireEvent } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { waitFor } from '@testing-library/dom';
-import { RequestContextProvider } from '#contexts/RequestContext';
-import { ToggleContextProvider } from '#contexts/ToggleContext';
-import { EventTrackingContextProvider } from '#contexts/EventTrackingContext';
import { STORY_PAGE } from '#app/routes/utils/pageTypes';
import * as trackingToggle from '#hooks/useTrackingToggle';
import OPTIMIZELY_CONFIG from '#lib/config/optimizely';
-import { ServiceContextProvider } from '../../contexts/ServiceContext';
+import {
+ AllTheProviders,
+ render,
+ renderHook,
+ act,
+ fireEvent,
+} from '../../components/react-testing-library-with-providers';
import pidginData from './fixtureData/tori-51745682.json';
import useClickTrackerHandler from '.';
@@ -43,26 +44,18 @@ const defaultToggles = {
},
};
-const WithContexts = ({ pageData, children, toggles = defaultToggles }) => (
- (
+
-
-
-
- {children}
-
-
-
-
-);
-
-const wrapper = ({ children }) => (
- {children}
+ {children}
+
);
const TestComponent = ({ hookProps }) => {
@@ -111,12 +104,19 @@ describe('Click tracking', () => {
});
it('should send a single tracking request on click', async () => {
+ const {
+ metadata: { atiAnalytics },
+ } = pidginData;
+
const spyFetch = jest.spyOn(global, 'fetch');
- const { getByTestId } = render(
-
-
- ,
- );
+ const { getByTestId } = render(, {
+ atiData: atiAnalytics,
+ pageData: pidginData,
+ pageType: STORY_PAGE,
+ pathname: '/pidgin',
+ service: 'pidgin',
+ toggles: defaultToggles,
+ });
expect(spyFetch).not.toHaveBeenCalled();
@@ -150,12 +150,18 @@ describe('Click tracking', () => {
it('should not send a tracking request if the toggle is disabled', async () => {
trackingToggleSpy.mockImplementationOnce(() => false);
-
- const { getByTestId } = render(
-
-
- ,
- );
+ const {
+ metadata: { atiAnalytics },
+ } = pidginData;
+
+ const { getByTestId } = render(, {
+ atiData: atiAnalytics,
+ pageData: pidginData,
+ pageType: STORY_PAGE,
+ pathname: '/pidgin',
+ service: 'pidgin',
+ toggles: defaultToggles,
+ });
await act(() => userEvent.click(getByTestId('test-component')));
@@ -163,11 +169,18 @@ describe('Click tracking', () => {
});
it('should send tracking request on click of child element (button)', async () => {
- const { getByText } = render(
-
-
- ,
- );
+ const {
+ metadata: { atiAnalytics },
+ } = pidginData;
+
+ const { getByText } = render(, {
+ atiData: atiAnalytics,
+ pageData: pidginData,
+ pageType: STORY_PAGE,
+ pathname: '/pidgin',
+ service: 'pidgin',
+ toggles: defaultToggles,
+ });
await act(() => userEvent.click(getByText('Button')));
@@ -198,6 +211,10 @@ describe('Click tracking', () => {
componentName: 'header',
};
+ const {
+ metadata: { atiAnalytics },
+ } = pidginData;
+
const TestComponentContainer = () => {
const handleClick = useClickTrackerHandler(parentHookProps);
@@ -208,11 +225,14 @@ describe('Click tracking', () => {
);
};
- const { getByText } = render(
-
-
- ,
- );
+ const { getByText } = render(, {
+ atiData: atiAnalytics,
+ pageData: pidginData,
+ pageType: STORY_PAGE,
+ pathname: '/pidgin',
+ service: 'pidgin',
+ toggles: defaultToggles,
+ });
await act(() => userEvent.click(getByText('Button')));
@@ -243,14 +263,24 @@ describe('Click tracking', () => {
it('should allow the user to navigate after clicking on a tracked link even if the tracking request fails', async () => {
const url = 'https://bbc.com/pidgin';
+ const {
+ metadata: { atiAnalytics },
+ } = pidginData;
+
global.fetch = jest.fn(() => {
throw new Error('Failed to fetch');
});
const { getByText } = render(
-
-
- ,
+ ,
+ {
+ atiData: atiAnalytics,
+ pageData: pidginData,
+ pageType: STORY_PAGE,
+ pathname: '/pidgin',
+ service: 'pidgin',
+ toggles: defaultToggles,
+ },
);
await act(() => userEvent.click(getByText('Link')));
@@ -265,11 +295,18 @@ describe('Click tracking', () => {
});
it('should not send tracking request on right click', () => {
- const { getByText } = render(
-
-
- ,
- );
+ const {
+ metadata: { atiAnalytics },
+ } = pidginData;
+
+ const { getByText } = render(, {
+ atiData: atiAnalytics,
+ pageData: pidginData,
+ pageType: STORY_PAGE,
+ pathname: '/pidgin',
+ service: 'pidgin',
+ toggles: defaultToggles,
+ });
act(() => {
fireEvent.contextMenu(getByText('Button'));
@@ -280,12 +317,22 @@ describe('Click tracking', () => {
it('should not navigate to the next page if preventNavigation is true', async () => {
const url = 'https://bbc.com/pidgin';
+ const {
+ metadata: { atiAnalytics },
+ } = pidginData;
+
const { getByText } = render(
-
-
- ,
+ ,
+ {
+ atiData: atiAnalytics,
+ pageData: pidginData,
+ pageType: STORY_PAGE,
+ pathname: '/pidgin',
+ service: 'pidgin',
+ toggles: defaultToggles,
+ },
);
await act(() => userEvent.click(getByText('Link')));
@@ -298,10 +345,20 @@ describe('Click tracking', () => {
it('should be able to override the campaignID that is sent to ATI', async () => {
const spyFetch = jest.spyOn(global, 'fetch');
const campaignID = 'custom-campaign';
+ const {
+ metadata: { atiAnalytics },
+ } = pidginData;
+
const { getByTestId } = render(
-
-
- ,
+ ,
+ {
+ atiData: atiAnalytics,
+ pageData: pidginData,
+ pageType: STORY_PAGE,
+ pathname: '/pidgin',
+ service: 'pidgin',
+ toggles: defaultToggles,
+ },
);
await act(() => userEvent.click(getByTestId('test-component')));
@@ -327,11 +384,20 @@ describe('Click tracking', () => {
user: { attributes: mockAttributes, id: mockUserId },
},
};
+ const {
+ metadata: { atiAnalytics },
+ } = pidginData;
const { getByTestId } = render(
-
-
- ,
+ ,
+ {
+ atiData: atiAnalytics,
+ pageData: pidginData,
+ pageType: STORY_PAGE,
+ pathname: '/pidgin',
+ service: 'pidgin',
+ toggles: defaultToggles,
+ },
);
fireEvent.click(getByTestId('test-component'));
@@ -348,10 +414,20 @@ describe('Click tracking', () => {
const mockOptimizelyTrack = jest.fn();
const mockOptimizely = undefined;
+ const {
+ metadata: { atiAnalytics },
+ } = pidginData;
+
const { getByTestId } = render(
-
-
- ,
+ ,
+ {
+ atiData: atiAnalytics,
+ pageData: pidginData,
+ pageType: STORY_PAGE,
+ pathname: '/pidgin',
+ service: 'pidgin',
+ toggles: defaultToggles,
+ },
);
fireEvent.click(getByTestId('test-component'));
@@ -362,10 +438,20 @@ describe('Click tracking', () => {
describe('Error handling', () => {
it('should not throw error and not send event to ATI when no tracking data passed into hook', async () => {
+ const {
+ metadata: { atiAnalytics },
+ } = pidginData;
+
const { container, getByText } = render(
-
-
- ,
+ ,
+ {
+ atiData: atiAnalytics,
+ pageData: pidginData,
+ pageType: STORY_PAGE,
+ pathname: '/pidgin',
+ service: 'pidgin',
+ toggles: defaultToggles,
+ },
);
await act(() => userEvent.click(getByText('Button')));
@@ -376,9 +462,15 @@ describe('Error handling', () => {
it('should not throw error and not send event to ATI when no pageData is provided from context providers', async () => {
const { container, getByText } = render(
-
-
- ,
+ ,
+ {
+ atiData: undefined,
+ pageData: undefined,
+ pageType: STORY_PAGE,
+ pathname: '/pidgin',
+ service: 'pidgin',
+ toggles: defaultToggles,
+ },
);
await act(() => userEvent.click(getByText('Button')));
@@ -392,10 +484,20 @@ describe('Error handling', () => {
foo: 'bar',
};
+ const {
+ metadata: { atiAnalytics },
+ } = pidginData;
+
const { container, getByText } = render(
-
-
- ,
+ ,
+ {
+ atiData: atiAnalytics,
+ pageData: pidginData,
+ pageType: STORY_PAGE,
+ pathname: '/pidgin',
+ service: 'pidgin',
+ toggles: defaultToggles,
+ },
);
await act(() => userEvent.click(getByText('Button')));
@@ -407,10 +509,20 @@ describe('Error handling', () => {
it('should not throw error and not send event to ATI when unexpected data type passed into hook', async () => {
const trackingData = ['unexpected data type'];
+ const {
+ metadata: { atiAnalytics },
+ } = pidginData;
+
const { container, getByText } = render(
-
-
- ,
+ ,
+ {
+ atiData: atiAnalytics,
+ pageData: pidginData,
+ pageType: STORY_PAGE,
+ pathname: '/pidgin',
+ service: 'pidgin',
+ toggles: defaultToggles,
+ },
);
await act(() => userEvent.click(getByText('Button')));
diff --git a/src/app/hooks/useViewTracker/fixtureData.json b/src/app/hooks/useViewTracker/fixtureData.json
index 3214ba90be9..36f82ca31da 100644
--- a/src/app/hooks/useViewTracker/fixtureData.json
+++ b/src/app/hooks/useViewTracker/fixtureData.json
@@ -8,7 +8,31 @@
"cps_asset_id": "51745682",
"cps_asset_type": "sty"
},
- "blockTypes": ["image", "paragraph", "list", "crosshead"],
+ "atiAnalytics": {
+ "campaigns": [
+ {
+ "campaignId": "5a988e3e39461b000e9dabfb",
+ "campaignName": "WS - Keep me on trend"
+ },
+ {
+ "campaignId": "5a988e4739461b000e9dabfc",
+ "campaignName": "WS - Update me"
+ }
+ ],
+ "categoryName": "News",
+ "contentId": "urn:bbc:cps:curie:asset:53870d86-88c5-6f4d-a260-f97c68606458",
+ "contentType": "article",
+ "language": "pcm",
+ "ldpThingIds": null,
+ "ldpThingLabels": null,
+ "pageIdentifier": "news::pidgin.news.story.51745682.page",
+ "pageTitle": "Adams Oshiomhole say 'I still be APC National Chairman'",
+ "producerId": null,
+ "timePublished": "2020-03-04T18:58:43.000Z",
+ "timeUpdated": "2020-03-04T19:26:11.000Z",
+ "producerName": "PIDGIN"
+ },
+ "blockTypes": ["image", "paragra ph", "list", "crosshead"],
"createdBy": "pidgin-v6",
"id": "urn:bbc:ares::asset:pidgin/tori-51745682",
"includeComments": false,
diff --git a/src/app/hooks/useViewTracker/index.test.jsx b/src/app/hooks/useViewTracker/index.test.jsx
index 95ba9a29282..e01b1a3e549 100644
--- a/src/app/hooks/useViewTracker/index.test.jsx
+++ b/src/app/hooks/useViewTracker/index.test.jsx
@@ -87,7 +87,7 @@ const defaultToggles = {
},
};
-const wrapper = ({ pageData, children, toggles = defaultToggles }) => (
+const wrapper = ({ pageData, atiData, children, toggles = defaultToggles }) => (
(
>
-
+
{children}
@@ -200,10 +200,15 @@ describe('Expected use', () => {
});
it('should send event to ATI and return correct tracking url when element is 50% or more in view for more than 1 second', async () => {
+ const {
+ metadata: { atiAnalytics },
+ } = fixtureData;
+
const { result } = renderHook(() => useViewTracker(trackingData), {
wrapper,
initialProps: {
pageData: fixtureData,
+ atiData: atiAnalytics,
},
});
const element = document.createElement('div');
@@ -248,10 +253,15 @@ describe('Expected use', () => {
});
it('should only send one view event when mutiple elements are viewed', async () => {
+ const {
+ metadata: { atiAnalytics },
+ } = fixtureData;
+
const { result } = renderHook(() => useViewTracker(trackingData), {
wrapper,
initialProps: {
pageData: fixtureData,
+ atiData: atiAnalytics,
},
});
const elementA = document.createElement('div');
@@ -282,10 +292,15 @@ describe('Expected use', () => {
});
it('should send one view event for multiple observed elements when at least one of them is in view', async () => {
+ const {
+ metadata: { atiAnalytics },
+ } = fixtureData;
+
const { result } = renderHook(() => useViewTracker(trackingData), {
wrapper,
initialProps: {
pageData: fixtureData,
+ atiData: atiAnalytics,
},
});
const element = document.createElement('div');
@@ -309,16 +324,22 @@ describe('Expected use', () => {
});
it('should send multiple view events for multiple hook instances', async () => {
+ const {
+ metadata: { atiAnalytics },
+ } = fixtureData;
+
const { result: resultA } = renderHook(() => useViewTracker(trackingData), {
wrapper,
initialProps: {
pageData: fixtureData,
+ atiData: atiAnalytics,
},
});
const { result: resultB } = renderHook(() => useViewTracker(trackingData), {
wrapper,
initialProps: {
pageData: fixtureData,
+ atiData: atiAnalytics,
},
});
const elementA = document.createElement('div');
@@ -349,10 +370,15 @@ describe('Expected use', () => {
});
it('should disconnect IntersectionObserver after event is sent', async () => {
+ const {
+ metadata: { atiAnalytics },
+ } = fixtureData;
+
const { result } = renderHook(() => useViewTracker(trackingData), {
wrapper,
initialProps: {
pageData: fixtureData,
+ atiData: atiAnalytics,
},
});
@@ -447,10 +473,15 @@ describe('Expected use', () => {
});
it('should not send event to ATI more than once when element is scrolled in and out of view', async () => {
+ const {
+ metadata: { atiAnalytics },
+ } = fixtureData;
+
const { result } = renderHook(() => useViewTracker(trackingData), {
wrapper,
initialProps: {
pageData: fixtureData,
+ atiData: atiAnalytics,
},
});
const element = document.createElement('div');
@@ -498,12 +529,17 @@ describe('Expected use', () => {
});
it('should be able to override the campaignID that is sent to ATI', async () => {
+ const {
+ metadata: { atiAnalytics },
+ } = fixtureData;
+
const { result } = renderHook(
() => useViewTracker({ ...trackingData, campaignID: 'custom-campaign' }),
{
wrapper,
initialProps: {
pageData: fixtureData,
+ atiData: atiAnalytics,
},
},
);
@@ -546,12 +582,17 @@ describe('Expected use', () => {
},
};
+ const {
+ metadata: { atiAnalytics },
+ } = fixtureData;
+
const { result } = renderHook(
() => useViewTracker({ ...trackingData, ...mockOptimizely }),
{
wrapper,
initialProps: {
pageData: fixtureData,
+ atiData: atiAnalytics,
},
},
);
diff --git a/src/app/pages/ArticlePage/fixtureData.js b/src/app/pages/ArticlePage/fixtureData.js
index 4b63204f873..899f6a975d0 100644
--- a/src/app/pages/ArticlePage/fixtureData.js
+++ b/src/app/pages/ArticlePage/fixtureData.js
@@ -174,15 +174,18 @@ export const articleDataNews = articleDataBuilder(
'Article Headline for Promo',
'Article summary.',
presetThings,
+ false,
+ blocksWithHeadlineAndText,
{
categoryName: 'Royal%20Wedding%202018~Duchess%20of%20Sussex',
contentId: 'urn:bbc:optimo:c0000000001o',
+ contentType: 'article',
language: 'en-gb',
ldpThingIds:
'2351f2b2-ce36-4f44-996d-c3c4f7f90eaa~803eaeb9-c0c3-4f1b-9a66-90efac3df2dc',
ldpThingLabels: 'Royal%20Wedding%202018~Duchess%20of%20Sussex',
nationsProducer: null,
- pageIdentifier: null,
+ pageIdentifier: 'news.articles.c0000000001o.page',
pageTitle: 'Article Headline for SEO',
timePublished: '2018-01-01T12:01:00.000Z',
timeUpdated: '2018-01-01T14:00:00.000Z',
@@ -199,9 +202,12 @@ export const articleDataPersian = articleDataBuilder(
'سرصفحه مقاله برای ارتقاء',
'خلاصه مقاله',
emptyThings,
+ false,
+ blocksWithHeadlineAndText,
{
categoryName: null,
contentId: 'urn:bbc:optimo:c0000000001o',
+ contentType: 'article',
language: 'en-gb',
ldpThingIds: null,
ldpThingLabels: null,
@@ -223,6 +229,8 @@ export const articleDataPidgin = articleDataBuilder(
'Article Headline for Promo in Pidgin',
'Article summary in Pidgin',
emptyThings,
+ false,
+ blocksWithHeadlineAndText,
{
categoryName: null,
contentId: 'urn:bbc:optimo:c0000000001o',
diff --git a/src/app/pages/MediaAssetPage/MediaAssetPage.jsx b/src/app/pages/MediaAssetPage/MediaAssetPage.jsx
index ae230722f63..7f6f5383636 100644
--- a/src/app/pages/MediaAssetPage/MediaAssetPage.jsx
+++ b/src/app/pages/MediaAssetPage/MediaAssetPage.jsx
@@ -74,7 +74,7 @@ MediaAssetPageGrid.propTypes = {
};
const MediaAssetPage = ({ pageData }) => {
- const { showRelatedTopics } = useContext(ServiceContext);
+ const { brandName, showRelatedTopics } = useContext(ServiceContext);
const { canonicalLink, isAmp } = useContext(RequestContext);
const isLegacyMediaAssetPage = () => canonicalLink.split('/').length > 7;
@@ -110,6 +110,13 @@ const MediaAssetPage = ({ pageData }) => {
const aboutTags = getAboutTags(pageData);
const mostWatchedData = path(['mostWatched'], pageData);
+ // ATI
+ const { atiAnalytics } = metadata;
+ const atiData = {
+ ...atiAnalytics,
+ pageTitle: `${atiAnalytics.pageTitle} - ${brandName}`,
+ };
+
const componentsToRender = {
fauxHeadline,
visuallyHiddenHeadline,
@@ -209,7 +216,7 @@ const MediaAssetPage = ({ pageData }) => {
aboutTags={aboutTags}
imageLocator={indexImageLocator}
/>
-
+
diff --git a/src/app/pages/MediaAssetPage/fixtureData.json b/src/app/pages/MediaAssetPage/fixtureData.json
index 9646d3774ac..5d76620769b 100644
--- a/src/app/pages/MediaAssetPage/fixtureData.json
+++ b/src/app/pages/MediaAssetPage/fixtureData.json
@@ -3,8 +3,37 @@
"firstPublished": 1568388704000,
"lastPublished": 1574252665000,
"lastUpdated": 1574252675611,
+ "atiAnalytics": {
+ "campaigns": [
+ {
+ "campaignId": "5ad8625ac93a9f000eecb253",
+ "campaignName": "Inspire me"
+ },
+ {
+ "campaignId": "5ad86285c93a9f000eecb256",
+ "campaignName": "Give me perspective"
+ },
+ {
+ "campaignId": "5ad86291c93a9f000eecb257",
+ "campaignName": "Keep me on trend"
+ }
+ ],
+ "categoryName": "Opinion",
+ "contentId": "urn:bbc:cps:curie:asset:5679389a-3ea6-0b40-9de4-f4d33d6bcd9f",
+ "contentType": "article-media-asset",
+ "language": "pcm",
+ "ldpThingIds": null,
+ "ldpThingLabels": null,
+ "pageIdentifier": "pidgin.media_asset.23248703.page",
+ "pageTitle": "Simorgh: Media Pod Build First CPS Media Asset Page in Simorgh & < >",
+ "producerId": null,
+ "timePublished": "2019-09-13T15:31:44.000Z",
+ "timeUpdated": "2020-06-10T14:24:07.000Z",
+ "producerName": "PIDGIN"
+ },
"analyticsLabels": {
"counterName": "pidgin.media_asset.23248703.page",
+ "contentId": "urn:bbc:cps:curie:asset:5679389a-3ea6-0b40-9de4-f4d33d6bcd9f",
"cps_asset_id": "23248703",
"cps_asset_type": "map"
},
diff --git a/src/app/pages/PhotoGalleryPage/PhotoGalleryPage.jsx b/src/app/pages/PhotoGalleryPage/PhotoGalleryPage.jsx
index 63a697fc356..89cbd5e0257 100644
--- a/src/app/pages/PhotoGalleryPage/PhotoGalleryPage.jsx
+++ b/src/app/pages/PhotoGalleryPage/PhotoGalleryPage.jsx
@@ -81,7 +81,7 @@ const getImageSizes = ({ blocks }) => {
};
const PhotoGalleryPage = ({ pageData }) => {
- const { showRelatedTopics } = useContext(ServiceContext);
+ const { brandName, showRelatedTopics } = useContext(ServiceContext);
const title = path(['promo', 'headlines', 'headline'], pageData);
const shortHeadline = path(['promo', 'headlines', 'shortHeadline'], pageData);
const summary = path(['promo', 'summary'], pageData);
@@ -104,6 +104,13 @@ const PhotoGalleryPage = ({ pageData }) => {
const lastPublished = getLastPublished(pageData);
const aboutTags = getAboutTags(pageData);
+ // ATI
+ const { atiAnalytics } = metadata;
+ const atiData = {
+ ...atiAnalytics,
+ pageTitle: `${atiAnalytics.pageTitle} - ${brandName}`,
+ };
+
const componentsToRender = {
fauxHeadline,
visuallyHiddenHeadline,
@@ -166,7 +173,7 @@ const PhotoGalleryPage = ({ pageData }) => {
aboutTags={aboutTags}
imageLocator={indexImageLocator}
/>
-
+
diff --git a/src/app/pages/PhotoGalleryPage/fixtureData.json b/src/app/pages/PhotoGalleryPage/fixtureData.json
index 4933f59ee22..62b3ad9ac29 100644
--- a/src/app/pages/PhotoGalleryPage/fixtureData.json
+++ b/src/app/pages/PhotoGalleryPage/fixtureData.json
@@ -3,6 +3,21 @@
"firstPublished": 1527410055000,
"lastPublished": 1527410057000,
"lastUpdated": 1563926718369,
+ "atiAnalytics": {
+ "campaigns": null,
+ "categoryName": "News",
+ "contentId": "urn:bbc:cps:curie:asset:38229308-a0fb-654a-a274-19bec0414560",
+ "contentType": "article-photo-gallery",
+ "language": "az",
+ "ldpThingIds": "03eb3674-6190-4cd7-8104-1a00991d67a3~0f8e45e2-6499-44b1-be1f-1a3dd81e8af7~5307a8d9-f620-40f5-92d4-f99c919a6ffa~6a73afa3-ea6b-45c1-80bb-49060b99f864~75612fa6-147c-4a43-97fa-fcf70d9cced3~8b04c2e8-5409-4e7d-9877-3ccaf04727af~9e6f8e15-894a-45cb-9db9-d8881e8e6ae2~a86bc15e-ccd0-4ea9-9903-df3d4575a176~d94f45db-bb47-4e7b-b1a2-5bc3e6afd0aa",
+ "ldpThingLabels": "History~Azerbaijan~Society~Culture~Politics~Human+rights~Azerbaijan+Democratic+Republic+100th+anniversary~Caucasus~Law+and+order",
+ "pageIdentifier": "azerbaijan::azeri.azerbaijan.photo_gallery.44208474.page",
+ "pageTitle": "Azərbaycan Xalq Cümhuriyyəti - Fotolarda",
+ "producerId": null,
+ "timePublished": "2018-05-27T08:34:15.000Z",
+ "timeUpdated": "2018-05-27T08:34:15.000Z",
+ "producerName": "AZERI"
+ },
"id": "urn:bbc:ares::asset:azeri/azerbaijan-44208474",
"locators": {
"assetUri": "/azeri/azerbaijan-44208474",
@@ -29,7 +44,10 @@
"allowPrintingSharingLinks": true
},
"analyticsLabels": {
+ "ldp_tags": "History~Azerbaijan~Society~Culture~Politics~Human+rights~Azerbaijan+Democratic+Republic+100th+anniversary~Caucasus~Law+and+order",
+ "ldp_ids": "03eb3674-6190-4cd7-8104-1a00991d67a3~0f8e45e2-6499-44b1-be1f-1a3dd81e8af7~5307a8d9-f620-40f5-92d4-f99c919a6ffa~6a73afa3-ea6b-45c1-80bb-49060b99f864~75612fa6-147c-4a43-97fa-fcf70d9cced3~8b04c2e8-5409-4e7d-9877-3ccaf04727af~9e6f8e15-894a-45cb-9db9-d8881e8e6ae2~a86bc15e-ccd0-4ea9-9903-df3d4575a176~d94f45db-bb47-4e7b-b1a2-5bc3e6afd0aa",
"cps_asset_type": "pgl",
+ "contentId": "urn:bbc:cps:curie:asset:38229308-a0fb-654a-a274-19bec0414560",
"counterName": "azeri.azerbaijan.photo_gallery.44208474.page",
"cps_asset_id": "44208474"
},
diff --git a/src/app/pages/StoryPage/StoryPage.jsx b/src/app/pages/StoryPage/StoryPage.jsx
index 4a5b0f3bdbd..59009027b8f 100644
--- a/src/app/pages/StoryPage/StoryPage.jsx
+++ b/src/app/pages/StoryPage/StoryPage.jsx
@@ -62,7 +62,8 @@ const MpuContainer = styled(AdContainer)`
`;
const StoryPage = ({ pageData }) => {
- const { serviceLang, lang, showRelatedTopics } = useContext(ServiceContext);
+ const { brandName, serviceLang, lang, showRelatedTopics } =
+ useContext(ServiceContext);
const { enabled: preloadLeadImageToggle } = useToggle('preloadLeadImage');
const title = path(['promo', 'headlines', 'headline'], pageData);
@@ -161,6 +162,13 @@ const StoryPage = ({ pageData }) => {
showAdsBasedOnLocation,
].every(Boolean);
+ // ATI
+ const { atiAnalytics } = metadata;
+ const atiData = {
+ ...atiAnalytics,
+ pageTitle: `${atiAnalytics.pageTitle} - ${brandName}`,
+ };
+
const componentsToRender = {
fauxHeadline,
visuallyHiddenHeadline,
@@ -283,7 +291,7 @@ const StoryPage = ({ pageData }) => {
aboutTags={aboutTags}
imageLocator={indexImageLocator}
/>
-
+
"`;
+exports[`Canonical Articles Analytics ATI 1`] = `""`;
exports[`Canonical Articles Footer Anchors should match text and url 1`] = `
{