简体   繁体   中英

sitecore analytics pdf download tracking

how do I track a pdf download with sitecore page events? I have code which tracks the event from back end but how do you determine whether the link is external, internal or a media link? And how can you determine if media link is pdf?

public void RegisterDownload(string downloadedResourceText, ID itemId)
        {
            if (downloadedResourceText != null)
            {
                if (TrackerEnabled())
                {
                    var page = CurrentPage();

                    page.Register(new PageEventData("Download", _downloadPageEventGuid) { ItemId = itemId.ToGuid(), Data = downloadedResourceText, DataKey = downloadedResourceText, Text = "Resource Downloaded" });
                }
            }
        }

If you want to do it with Sitecore, just set the event in the Tracking field for the PDF in the media library.

在此输入图像描述

Then it shows up in the experience profile or you can trigger a engagement plan, etc...

在此输入图像描述

If you are looking to do it programmatically, you have to create the details of the event. You just pass in a string of "User did X" to the page event code you have posted. The itemID is the page they were on when they did it. If it was a brochure, you would have "downloaded the brochure for product XYZ".

Some good details of the properties of the page event call can be found here: https://doc.sitecore.net/sitecore_experience_platform/82/digital_marketing/marketing_operations/events/register_a_page_event_programmatically

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM