Expand my Community achievements bar.

Announcement: Calling all learners and mentors! Applications are now open for the Adobe Analytics 2024 Mentorship Program! Come learn from the best to prepare for an official certification in Adobe Analytics.
SOLVED

ACDL Tracking: How to set pageName on s.tl() beacon?

Avatar

Level 4

Hey everyone,

 

I've been exploring the ACDL Launch Extension and so far I've gotten pretty far with it.  I get that the 'eventInfo.path' provides you the AEM core component ID that was associated with the AEM event.

 

Of example, on the WKND site, the home page page load event of cmp:show references the eventInfo.path of 'page.page-2eee4f8914'.  You can then add that ID to the window.adobeDataLayer.getState() method so you can grab the name of the page (dc:title) in a Data Element.

 

but my question is, how do you get the 'page.page-2eee4f8914' pageName when you click on button?

Meaning, when I click my 'eventInfo.path' updates to the component I clicked on, for example 'component.teaser-af173d94fb-cta-fdf48f11a9'.  That component has a 'dc:title' variable with the value of 'View Trips', which of course is NOT the pageName, that would be the 'link name'.  But on my s.tl() beacon I want to capture both the pageName and the Link Name.  

 

So again, how do you get the pageName (dc:title = wknd adventures and travel) when you click a button that has a dc:title = view trips?

 

Any thoughts or ideas? 

1 Accepted Solution

Avatar

Correct answer by
Level 4

@yuhuisg Thanks so much for the suggestion and for trying to help.  I had already reviewed the Adobe documentation and since I'm using the 
ACDL Extension, it doesn't really sync with my approach.

 

I did get it to work, but I'm not really sure how stable and scalable my solution is.  In short, on the page view event, I set up my Launch rule to 'clear variables' and then set evar1 = page.page-2eee4f8914[dc:title].

then on the click event, i set up my Launch rule WITHOUT 'clear variables' and in the custom code of the set variable action tile, i add evar1 to linkTrackVars.  My thinking is that evar1 will remain the page name until i clear it or until the next page view event.  

 

Like I said it does work, but I would prefer to use 'clear variables' on all my Launch rules as that's the best way to avoid beacon bleed over in my experience.  

 

some would argue that with eVar persistence you don't need to set page name on the click beacon but i'm of the mind that we should set variables on every beacon to reduce the risk of dropping information if the visit expires and the persistence values get reset.

 

The alternative approach that i'm now thinking about is to build a loop that triggers with the click event.  the loop would scan through all of the data layer records looking for the most recent page view event, but there is a 'timing' concern because with click tracking you have very little time to perform tasks before the 'unload' of the browser cancels all the outbound network calls.  The strategy also doesn't make sense for single page apps, at least at first glance. 

 

Any way, thanks for trying to help.  Let me know if you have any other ideas.  

View solution in original post

4 Replies

Avatar

Community Advisor

I really dislike the AEM integration of ACDL, because it introduces screwed up implementations like what you're experiencing, and also it depends so heavily on custom code.

With that said...

I haven't used this AEM-ACDL integration myself, so my answer relies on the documentation at https://experienceleague.adobe.com/docs/experience-manager-learn/sites/integrations/adobe-client-dat...

It looks like a "@type" key is also pushed into ACDL, and the value of that key indicates whether it's a page or not. If so, then your task is to write a custom code that determines if the "@type" value is of a page view type, then save the "dc:title" value as your page name.

(Can you see how ridiculous the AEM-ACDL integration is from this one issue?  )

Avatar

Correct answer by
Level 4

@yuhuisg Thanks so much for the suggestion and for trying to help.  I had already reviewed the Adobe documentation and since I'm using the 
ACDL Extension, it doesn't really sync with my approach.

 

I did get it to work, but I'm not really sure how stable and scalable my solution is.  In short, on the page view event, I set up my Launch rule to 'clear variables' and then set evar1 = page.page-2eee4f8914[dc:title].

then on the click event, i set up my Launch rule WITHOUT 'clear variables' and in the custom code of the set variable action tile, i add evar1 to linkTrackVars.  My thinking is that evar1 will remain the page name until i clear it or until the next page view event.  

 

Like I said it does work, but I would prefer to use 'clear variables' on all my Launch rules as that's the best way to avoid beacon bleed over in my experience.  

 

some would argue that with eVar persistence you don't need to set page name on the click beacon but i'm of the mind that we should set variables on every beacon to reduce the risk of dropping information if the visit expires and the persistence values get reset.

 

The alternative approach that i'm now thinking about is to build a loop that triggers with the click event.  the loop would scan through all of the data layer records looking for the most recent page view event, but there is a 'timing' concern because with click tracking you have very little time to perform tasks before the 'unload' of the browser cancels all the outbound network calls.  The strategy also doesn't make sense for single page apps, at least at first glance. 

 

Any way, thanks for trying to help.  Let me know if you have any other ideas.  

Avatar

Community Advisor

It's great that you managed to get it to work! 

I think your approach of not using "Clear Variables" is fine. I actually don't like "Clear Variables" and even contributed a post here to advise against using it: https://experienceleaguecommunities.adobe.com/t5/adobe-analytics-blogs/don-t-use-clearvars/ba-p/4107...

I also have the same thinking as you about setting eVars explicitly. I prefer explicit values rather than implicit ones, because implicit ones tend to cause more confusion when interpreting reports.

For your alternative approach, instead of looping through the data layer during the click event, you could use _satellite.setVar() to set a temporary variable with the page name during the pageview event. Then you can use _satellite.getVar() in the subsequent events to retrieve this page name. Of course, the assumption here would be that this temporary variable doesn't get overwritten with a new page name if a 2nd pageview event were to get triggered before your click event.

Avatar

Level 3

I had a similar issue & the below worked for me

 

1. You might have a data element capturing Page name. Change the storage duration of that data element to Page view

2. Use the dataelement in the button click rule along with clear events.

3. Also add linkTrackVars = eVar1(which captures page name ) in the custom code section

 

I am using this approach to capture page name & url for all of my rules.