Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Dan 2 posts 72 karma points
    Nov 13, 2023 @ 15:24
    Dan
    0

    Can you publish a unique page identifier?

    I am looking to publish a unique page identifier with each page. Ideally, this would be published to a datalayer similar to what is below. Can this be done?

    <script>
         window.dataLayer = window.dataLayer || [];    
         dataLayer.push({
           'pageID': '1234567',
         });
    </script>
    
  • Søren Kottal 713 posts 4571 karma points MVP 6x c-trib
    Nov 14, 2023 @ 13:15
    Søren Kottal
    0

    Hi Dan

    Each page has its own id or key that you can use for this, check out the reference:

    https://our.umbraco.com/apidocs/v8/csharp/api/Umbraco.Core.Models.PublishedContent.IPublishedContent.html#UmbracoCoreModelsPublishedContentIPublishedContent_Id

    https://our.umbraco.com/apidocs/v8/csharp/api/Umbraco.Core.Models.PublishedContent.IPublishedElement.html#UmbracoCoreModelsPublishedContentIPublishedElement_Key

    (I know I'm linking to v8 docs, but couldn't find similar for modern. In the end, IPublishedContent and IPublishedElements still has the Id and Key properties)

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies