Skip to content

Commit c309cc0

Browse files
authored
AMP analytics tag for MGID and Idealmedia (#40460)
1 parent fbbf5c6 commit c309cc0

5 files changed

Lines changed: 96 additions & 0 deletions

File tree

examples/analytics-vendors.amp.html

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575
<option>gfksensic</option>
7676
<option>googleanalytics</option>
7777
<option>ibeatanalytics</option>
78+
<option>idealmedia</option>
7879
<option>infonline</option>
7980
<option>infonline_anonymous</option>
8081
<option>iplabel</option>
@@ -90,6 +91,7 @@
9091
<option>mediator</option>
9192
<option>memo</option>
9293
<option>metrika</option>
94+
<option>mgid</option>
9395
<option>mobify</option>
9496
<option>moengage</option>
9597
<option>mparticle</option>
@@ -1122,6 +1124,40 @@
11221124
</amp-analytics>
11231125
<!-- End Mediator.media example -->
11241126

1127+
<!-- MGID tracking.
1128+
Please replace the values for "site", "client_id", and "publishers_sites_id"
1129+
with your MGID configuration values.
1130+
-->
1131+
<amp-analytics type="mgid" id="mgid">
1132+
<script type="application/json">
1133+
{
1134+
"vars": {
1135+
"site": "SITE_ID",
1136+
"client_id": "CLIENT_ID",
1137+
"publishers_sites_id": "PUBLISHERS_SITES_ID"
1138+
}
1139+
}
1140+
</script>
1141+
</amp-analytics>
1142+
<!-- End MGID example -->
1143+
1144+
<!-- Idealmedia tracking.
1145+
Please replace the values for "site", "client_id", and "publishers_sites_id"
1146+
with your Idealmedia configuration values.
1147+
-->
1148+
<amp-analytics type="idealmedia" id="idealmedia">
1149+
<script type="application/json">
1150+
{
1151+
"vars": {
1152+
"site": "SITE_ID",
1153+
"client_id": "CLIENT_ID",
1154+
"publishers_sites_id": "PUBLISHERS_SITES_ID"
1155+
}
1156+
}
1157+
</script>
1158+
</amp-analytics>
1159+
<!-- End Idealmedia example -->
1160+
11251161
<!-- Memo Tracking -->
11261162
<amp-analytics type="memo" id="memo">
11271163
<script type="application/json">

extensions/amp-analytics/0.1/test/vendor-requests.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,9 @@
200200
"host": "https://api.ibeat-analytics.com",
201201
"track": "https://api.ibeat-analytics.com/ping-amp?url=_source_url_&sid=_client_id(_iibeat_session)_&ua=_user_agent_&ref=_document_referrer_&at=_incremental_engaged_time_&tt=!totalTime&pid=_page_view_id_&d=!d&dn=_source_hostname_&ct=!ct&pt=!pt&hid=!hid&au=!au&ag=!ag&aid=!aid&cn=_canonical_url_&pot=!timerStart&rct=1&id=!id&sec=!sec&tgs=!tgs&pc=!pc&vct=!vct&xcld=!xcld"
202202
},
203+
"idealmedia": {
204+
"pageview": "https://c.idealmedia.io/pv?site=!site&client_id=!client_id&publishers_sites_id=!publishers_sites_id&i=1&pr=_external_referrer_&cbuster=_random_&pvid=_page_view_id_64_&implVersion=19&cxurl=_canonical_url_&pv_types=tpv&scua=%22_uach(architecture)_%22&scub=%22_uach(bitness)_%22&scu_amp=_uach(brands)_&scufvl_amp=_uach(fullVersionList)_&scum=%3F_if(_equals(_uach(mobile)__%2Ctrue)_, 1, 0)&scumd=%22_uach(model)_%22&scup=%22_uach(platform)_%22&scupv=%22_uach(platformVersion)_%22&scufv=%22_uach(uaFullVersion)_%22&scuw=%3F_if(_equals(_uach(wow64)__%2Ctrue)_, 1, 0)&gdpr_consent=_if(_equals(_consent_metadata(consentStringType)_%2C1)_%2C_consent_string_)__if(_equals(_consent_metadata(consentStringType)_%2C2)_%2C_consent_string_)_&gdpr=_if(_equals(_consent_metadata(gdprApplies)_%2Ctrue)_%2C1)__if(_equals(_consent_metadata(gdprApplies)_%2Cfalse)_%2C0)_&us_privacy=_if(_equals(_consent_metadata(consentStringType)_%2C3)_%2C_consent_string_)_&gpp=_if(_equals(_consent_metadata(consentStringType)_%2C4)_%2C_consent_string_)_&gpp_sid=_if(_equals(_consent_metadata(consentStringType)_%2C4)_%2C_consent_metadata(gppSectionId)_)_"
205+
},
203206
"infonline": {
204207
"pageview": "!url?st=!st&sv=ke&ap=1&co=!co&cp=!cp&ps=!ps&act=_consent_string_&acs=_if(_equals(_consent_state_%2Csufficient)_%2C1)__if(_equals(_consent_state_%2Cinsufficient)_%2C0)__if(_equals(_consent_state_%2C)_%2C-1)_&host=_canonical_host_&path=_canonical_path_&type=pageview",
205208
"event": "!url?st=!st&ev=!ev&sv=ke&ap=1&co=!co&cp=!cp&ps=!ps&act=_consent_string_&acs=_if(_equals(_consent_state_%2Csufficient)_%2C1)__if(_equals(_consent_state_%2Cinsufficient)_%2C0)__if(_equals(_consent_state_%2C)_%2C-1)_&host=_canonical_host_&path=_canonical_path_&type=event"
@@ -300,6 +303,9 @@
300303
"visible": "https://elsa.memoinsights.com/n?amp=true&pid=!pid&title=_title_&url=_canonical_url_&date=!published_at&authors=!authors&referrer=_document_referrer_&page_url=_source_url_&user_id=_client_id(memo_amp_id)_&domain=_canonical_host_&v=amp",
301304
"timer": "https://elsa.memoinsights.com/t?amp=true&pid=!pid&title=_title_&url=_canonical_url_&date=!published_at&authors=!authors&referrer=_document_referrer_&page_url=_source_url_&user_id=_client_id(memo_amp_id)_&domain=_canonical_host_&v=amp&t=5000&e=5000"
302305
},
306+
"mgid": {
307+
"pageview": "https://c.mgid.com/pv?site=!site&client_id=!client_id&publishers_sites_id=!publishers_sites_id&i=1&pr=_external_referrer_&cbuster=_random_&pvid=_page_view_id_64_&implVersion=19&cxurl=_canonical_url_&pv_types=tpv&scua=%22_uach(architecture)_%22&scub=%22_uach(bitness)_%22&scu_amp=_uach(brands)_&scufvl_amp=_uach(fullVersionList)_&scum=%3F_if(_equals(_uach(mobile)__%2Ctrue)_, 1, 0)&scumd=%22_uach(model)_%22&scup=%22_uach(platform)_%22&scupv=%22_uach(platformVersion)_%22&scufv=%22_uach(uaFullVersion)_%22&scuw=%3F_if(_equals(_uach(wow64)__%2Ctrue)_, 1, 0)&gdpr_consent=_if(_equals(_consent_metadata(consentStringType)_%2C1)_%2C_consent_string_)__if(_equals(_consent_metadata(consentStringType)_%2C2)_%2C_consent_string_)_&gdpr=_if(_equals(_consent_metadata(gdprApplies)_%2Ctrue)_%2C1)__if(_equals(_consent_metadata(gdprApplies)_%2Cfalse)_%2C0)_&us_privacy=_if(_equals(_consent_metadata(consentStringType)_%2C3)_%2C_consent_string_)_&gpp=_if(_equals(_consent_metadata(consentStringType)_%2C4)_%2C_consent_string_)_&gpp_sid=_if(_equals(_consent_metadata(consentStringType)_%2C4)_%2C_consent_metadata(gppSectionId)_)_"
308+
},
303309
"metrika": {
304310
"pageview": "https://mc.yandex.ru/watch/!counterId?browser-info=pv%3A1%3Aamp%3A1%3Az%3A_timezone_%3Ai%3A_timestamp_%3Arn%3A_random_%3Ala%3A_browser_language_%3Aen%3A_document_charset_%3Arqn%3A1%3As%3A_screen_width_x_screen_height_x_screen_color_depth_%3Aw%3A_available_screen_width_x_available_screen_height_%3Ads%3A_domain_lookup_time_%2C_tcp_connect_time_%2C_server_response_time_%2C_page_download_time_%2C_nav_timing(navigationStart%2CfetchStart)_%2C_redirect_time_%2C_nav_redirect_count_%2C_nav_timing(domLoading%2CdomInteractive)_%2C_nav_timing(domContentLoadedEventStart%2CdomContentLoadedEventEnd)_%2C_nav_timing(navigationStart%2CdomComplete)_%2C_page_load_time_%2C_nav_timing(loadEventStart%2CloadEventEnd)_%2C_content_load_time_%3Au%3A_client_id(_ym_uid)_%3Ahid%3A_page_view_id_%3At%3A_title_&site-info=!yaParams&page-url=_source_url_&page-ref=_external_referrer_",
305311
"notBounce": "https://mc.yandex.ru/watch/!counterId?browser-info=ar%3A1%3Anb%3A1%3Aamp%3A1%3Az%3A_timezone_%3Ai%3A_timestamp_%3Arn%3A_random_%3Ala%3A_browser_language_%3Aen%3A_document_charset_%3Arqn%3A1%3As%3A_screen_width_x_screen_height_x_screen_color_depth_%3Aw%3A_available_screen_width_x_available_screen_height_%3Ads%3A_domain_lookup_time_%2C_tcp_connect_time_%2C_server_response_time_%2C_page_download_time_%2C_nav_timing(navigationStart%2CfetchStart)_%2C_redirect_time_%2C_nav_redirect_count_%2C_nav_timing(domLoading%2CdomInteractive)_%2C_nav_timing(domContentLoadedEventStart%2CdomContentLoadedEventEnd)_%2C_nav_timing(navigationStart%2CdomComplete)_%2C_page_load_time_%2C_nav_timing(loadEventStart%2CloadEventEnd)_%2C_content_load_time_%3Au%3A_client_id(_ym_uid)_%3Ahid%3A_page_view_id_%3At%3A_title_&page-url=_source_url_&page-ref=_external_referrer_",
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"vars": {
3+
"site": "",
4+
"client_id": "",
5+
"publishers_sites_id": ""
6+
},
7+
"requests": {
8+
"pageview": "https://c.idealmedia.io/pv?site=${site}&client_id=${client_id}&publishers_sites_id=${publishers_sites_id}&i=1&pr=${externalReferrer}&cbuster=${random}&pvid=${pageViewId64}&implVersion=19&cxurl=${canonicalUrl}&pv_types=tpv&scua=%22${uach(architecture)}%22&scub=%22${uach(bitness)}%22&scu_amp=${uach(brands)}&scufvl_amp=${uach(fullVersionList)}&scum=%3F$IF($EQUALS(${uach(mobile)}, true), 1, 0)&scumd=%22${uach(model)}%22&scup=%22${uach(platform)}%22&scupv=%22${uach(platformVersion)}%22&scufv=%22${uach(uaFullVersion)}%22&scuw=%3F$IF($EQUALS(${uach(wow64)}, true), 1, 0)&gdpr_consent=$IF($EQUALS(CONSENT_METADATA(consentStringType), 1), ${consentString})$IF($EQUALS(CONSENT_METADATA(consentStringType), 2), ${consentString})&gdpr=$IF($EQUALS(CONSENT_METADATA(gdprApplies), true), 1)$IF($EQUALS(CONSENT_METADATA(gdprApplies), false), 0)&us_privacy=$IF($EQUALS(CONSENT_METADATA(consentStringType), 3), ${consentString})&gpp=$IF($EQUALS(CONSENT_METADATA(consentStringType), 4), ${consentString})&gpp_sid=$IF($EQUALS(CONSENT_METADATA(consentStringType), 4), CONSENT_METADATA(gppSectionId))"
9+
},
10+
"triggers": {
11+
"trackPageview": {
12+
"on": "visible",
13+
"request": "pageview"
14+
}
15+
},
16+
"transport": {
17+
"beacon": false,
18+
"xhrpost": false,
19+
"image": true
20+
}
21+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"vars": {
3+
"site": "",
4+
"client_id": "",
5+
"publishers_sites_id": ""
6+
},
7+
"requests": {
8+
"pageview": "https://c.mgid.com/pv?site=${site}&client_id=${client_id}&publishers_sites_id=${publishers_sites_id}&i=1&pr=${externalReferrer}&cbuster=${random}&pvid=${pageViewId64}&implVersion=19&cxurl=${canonicalUrl}&pv_types=tpv&scua=%22${uach(architecture)}%22&scub=%22${uach(bitness)}%22&scu_amp=${uach(brands)}&scufvl_amp=${uach(fullVersionList)}&scum=%3F$IF($EQUALS(${uach(mobile)}, true), 1, 0)&scumd=%22${uach(model)}%22&scup=%22${uach(platform)}%22&scupv=%22${uach(platformVersion)}%22&scufv=%22${uach(uaFullVersion)}%22&scuw=%3F$IF($EQUALS(${uach(wow64)}, true), 1, 0)&gdpr_consent=$IF($EQUALS(CONSENT_METADATA(consentStringType), 1), ${consentString})$IF($EQUALS(CONSENT_METADATA(consentStringType), 2), ${consentString})&gdpr=$IF($EQUALS(CONSENT_METADATA(gdprApplies), true), 1)$IF($EQUALS(CONSENT_METADATA(gdprApplies), false), 0)&us_privacy=$IF($EQUALS(CONSENT_METADATA(consentStringType), 3), ${consentString})&gpp=$IF($EQUALS(CONSENT_METADATA(consentStringType), 4), ${consentString})&gpp_sid=$IF($EQUALS(CONSENT_METADATA(consentStringType), 4), CONSENT_METADATA(gppSectionId))"
9+
},
10+
"triggers": {
11+
"trackPageview": {
12+
"on": "visible",
13+
"request": "pageview"
14+
}
15+
},
16+
"transport": {
17+
"beacon": false,
18+
"xhrpost": false,
19+
"image": true
20+
}
21+
}

extensions/amp-analytics/analytics-vendors-list.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,12 @@ Adds support for Ibeat Analytics.
248248

249249
<!-- markdown-link-check-disable -->
250250

251+
### Idealmedia
252+
253+
Type attribute value: `idealmedia`
254+
255+
Adds support for Idealmedia analytics. More information can be found at [idealmedia.io](https://idealmedia.io).
256+
251257
### INFOnline / IVW
252258

253259
Type attribute value: `infonline`
@@ -368,6 +374,12 @@ Adds support for mediarithmics. More information and configuration details can b
368374

369375
Type attribute value: `mediator`
370376

377+
### MGID
378+
379+
Type attribute value: `mgid`
380+
381+
Adds support for MGID analytics. More information can be found at [mgid.com](https://mgid.com).
382+
371383
### Memo
372384

373385
Type attribute value: `memo`

0 commit comments

Comments
 (0)