{"id":7270,"date":"2022-09-01T09:26:27","date_gmt":"2022-09-01T09:26:27","guid":{"rendered":"https:\/\/staging.datarevolt.agency\/?p=1314"},"modified":"2026-05-07T15:17:50","modified_gmt":"2026-05-07T12:17:50","slug":"my-life-with-amp-part-2","status":"publish","type":"post","link":"https:\/\/datarevolt.startweb.ro\/ro\/my-life-with-amp-part-2\/","title":{"rendered":"My life with AMP &#8211; part 2"},"content":{"rendered":"<h3>AMP + Google Analytics 4<\/h3>\n<p>I\u2019ve talked about what is AMP and how to track AMP pages and send data into Universal Analytics <a href=\"https:\/\/blog.datarevolt.agency\/my-life-with-amp\/\">here<\/a>. But in this story I want to show you how to send data to <a href=\"https:\/\/support.google.com\/analytics\/answer\/10089681?hl=en\">Google Analytics 4<\/a>. Since Google\u2019s announcement that from July 1, 2023, standard Universal Analytics properties will no longer process data, this is a must-have.<\/p>\n<p>Google search results on this topic are not very optimistic. I have found only one solution from <a href=\"https:\/\/www.thyngster.com\/how-to-track-amp-pages-with-google-analytics-4\">David Vallejo<\/a>, but without developer support this is not an option.<\/p>\n<p>I\u2019ve found another solution for one of our clients. We use Google Tag Manager for AMP to track users activity on AMP pages but the GTM AMP container doesn\u2019t have a dedicated tag for GA4 (yet, I hope).<\/p>\n<p>This is where I want you to meet <a href=\"https:\/\/segment.com\/\">Segment<\/a>. Twilio Segment is a customer data platform (CDP) that helps you collect, clean, and activate your customer data.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2074\" src=\"https:\/\/datarevolt.startweb.ro\/wp-content\/uploads\/2022\/09\/Twilio-Segment-logo.png\" alt=\"Twilio Segment logo\" width=\"1224\" height=\"310\" \/><\/p>\n<p><strong>So, let\u2019s get started!<\/strong><\/p>\n<p>First, you will need a <a href=\"https:\/\/segment.com\/pricing\/\">Segment Account<\/a>. If your site does not have a lot of traffic, you can go with the free plan that includes: 1,000 visitors\/month and 2 data sources.<\/p>\n<p>Then, select your AMP Source and get the API Key provided.<\/p>\n<p>You can follow the steps from here: <a href=\"https:\/\/segment.com\/docs\/connections\/sources\/catalog\/libraries\/mobile\/amp\/\">https:\/\/segment.com\/docs\/connections\/sources\/catalog\/libraries\/mobile\/amp\/<\/a> or you can simply add Segment to your AMP pages with your GTM AMP container by selecting the Segment Tag Configuration and adding your AMP Source API Key.<\/p>\n<p>After you publish your changes, you should see data flowing in your Segment Source (hit debugger and you can see live activity from your site).<\/p>\n<p>The next thing you need to do is to add a <a href=\"https:\/\/segment.com\/docs\/connections\/destinations\/\">destination<\/a>. Go to Destinations and select Google Analytics 4 and you only need to add the measurement ID and a secret API Key that you generate from your GA4 Account.<\/p>\n<p>The Segment App is very user friendly so you will find all the details here.<\/p>\n<p>After you finish setting up the destination, you will have one more thing to do: mapping.<\/p>\n<p><a href=\"https:\/\/segment.com\/docs\/connections\/destinations\/catalog\/actions-google-analytics-4\/#available-actions\">Google Analytics 4<\/a> is a cloud-mode destination, meaning that Segment collects data from the device, but it will forward the events from Segment servers to GA&#8217;s servers. For any events you wish to send to GA4, you&#8217;ll need to map these.<\/p>\n<p>Select the GA4 destination, go to mappings and select (for example) Page View.<\/p>\n<p>This is how a pageview trigger will look like:<\/p>\n<p>You can add a test event (remember that you already have data flowing in your source). Segment will find an event that can be triggered by the event trigger you defined.<\/p>\n<p>Next, you will need to define how data will be mapped from your source to your destination (ex: what variable gives the page title, page path, client ID etc.) and then you can start testing. To test this action, Segment will send the API request to Google Analytics 4 to track an event with the test event you added.<\/p>\n<p>To finish testing you can do 2 more things:<\/p>\n<ol>\n<li>In Segment, go to your GA4 destination -&gt; Event Delivery<\/li>\n<li>Go to your GA4 Property and check that you indeed are receiving data from your AMP pages. This is usually easy to check since your AMP pages have a different URL (something like \u2018\/amp\/pagepath\u2019 or \u2018\/pagepath?page=2\u2019).<\/li>\n<\/ol>\n<p>Here is an example for a specific page. We have views for the non-AMP version of the page (data sent with GTM + GA4) and for the AMP version for the same page (data sent with this implementation)<\/p>\n<p><strong>Good Luck!<\/strong><\/p>","protected":false},"excerpt":{"rendered":"<p>AMP + Google Analytics 4 I\u2019ve talked about what is AMP and how to track AMP pages and send data into Universal Analytics here. But in this story I want to show you how to send data to Google Analytics 4. Since Google\u2019s announcement that from July 1, 2023, standard Universal Analytics properties will no [&hellip;]<\/p>","protected":false},"author":1,"featured_media":1315,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[27],"tags":[35],"class_list":["post-7270","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-data-marketing","tag-amp"],"_links":{"self":[{"href":"https:\/\/datarevolt.startweb.ro\/ro\/wp-json\/wp\/v2\/posts\/7270","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/datarevolt.startweb.ro\/ro\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/datarevolt.startweb.ro\/ro\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/datarevolt.startweb.ro\/ro\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/datarevolt.startweb.ro\/ro\/wp-json\/wp\/v2\/comments?post=7270"}],"version-history":[{"count":1,"href":"https:\/\/datarevolt.startweb.ro\/ro\/wp-json\/wp\/v2\/posts\/7270\/revisions"}],"predecessor-version":[{"id":7565,"href":"https:\/\/datarevolt.startweb.ro\/ro\/wp-json\/wp\/v2\/posts\/7270\/revisions\/7565"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/datarevolt.startweb.ro\/ro\/wp-json\/wp\/v2\/media\/1315"}],"wp:attachment":[{"href":"https:\/\/datarevolt.startweb.ro\/ro\/wp-json\/wp\/v2\/media?parent=7270"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/datarevolt.startweb.ro\/ro\/wp-json\/wp\/v2\/categories?post=7270"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/datarevolt.startweb.ro\/ro\/wp-json\/wp\/v2\/tags?post=7270"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}