Expand my Community achievements bar.

SOLVED

How do I create a data element that captures all of my events for pathing?

Avatar

Level 4

I am trying to implement pathing that includes page names and all of the events I implemented in DTM. On a blog I read , the author mentioned to me that he created two data elements. One for page name and the other for custom hits. 

See below what blog author told me what he did. 

"I did two data elements, one for pagename and for custom hits. Then in the tool settings -> global variables, I added propX with my data elements. This wasn’t enough for custom hits, so I had to add custom code (can be found in the bottom of all the settings) s.linkTrackVars=”propX”; and voila it sent my custom hit to that prop when I tested with certain clickable element. This way you get to automate the process, but of course you could always manually add this prop to every custom hit you make in DTM, and that should also work.

Sorry for “not so detailed” instructions, just too busy at the moment. But if you could tell me more about the problem, then hopefully I can give more advice. Or maybe better to ask in Adobe’s help forum, I’m sure there are many hardcore DTM users and they surely can give you better guidance?"

I am interested in doing the same thing, but not sure of all the steps needed to do so.

 

Thank you

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi Bill,

As per our understanding from the scenario , you are basically trying to capture a page name lets say "Home Page"  and an event let's say "Carousel_Image_Click"  in two data elements i.e. for PageName create data element "%PageName%" and  for event  create a data element  "%Custom_Hit%"  respectively and then may be concatenate these two values such as 

s.propx= s.getVar('PageName') + " : " + s.getVar('Custom_Hit'); 

So that you can then have pathing on propx to identify sequence of events concatenated with pagename on which they occur .

Please let me know if I am anywhere wrong in my understanding of the scenario . However if we are good to go then we can proceed with the below solution.

As you might have already created Event based rules to listen to the "different types Events" i.e. fire on button click etc.   

So what we will do is define a data element on the fly  in and then use it in the interface for above created event based rule  Hence to achieve this,  we can dynamically capture the value of the event, and can set it  when defining the criteria for an event based rule, within the custom code block using below code:  

var str= $(this).attr("CustomHit"); // This line will fetch the CustomHit  attribute(i.e. The customHit attribute will have the value such as "Image Carousel click" ) of the link clicked when an event click rule is fired on clicking of a link on the page . _satellite.setVar('Custom_Hit',str); return true;

and then we assume that the data element i.e %PageName% is  already available on the page to use and then we can write the below custom code in Custom code section of Adobe Analytics Tab in an event based rule.

s.propX=  _satellite.getVar('Custom_Hit') + " : "  + _satellite.getVar('PageName'); s.linkTrackVars=”propX”

Please do let us know if you have any questions or queries.

Thanks & Regards

Parit Mittal

View solution in original post

1 Reply

Avatar

Correct answer by
Level 10

Hi Bill,

As per our understanding from the scenario , you are basically trying to capture a page name lets say "Home Page"  and an event let's say "Carousel_Image_Click"  in two data elements i.e. for PageName create data element "%PageName%" and  for event  create a data element  "%Custom_Hit%"  respectively and then may be concatenate these two values such as 

s.propx= s.getVar('PageName') + " : " + s.getVar('Custom_Hit'); 

So that you can then have pathing on propx to identify sequence of events concatenated with pagename on which they occur .

Please let me know if I am anywhere wrong in my understanding of the scenario . However if we are good to go then we can proceed with the below solution.

As you might have already created Event based rules to listen to the "different types Events" i.e. fire on button click etc.   

So what we will do is define a data element on the fly  in and then use it in the interface for above created event based rule  Hence to achieve this,  we can dynamically capture the value of the event, and can set it  when defining the criteria for an event based rule, within the custom code block using below code:  

var str= $(this).attr("CustomHit"); // This line will fetch the CustomHit  attribute(i.e. The customHit attribute will have the value such as "Image Carousel click" ) of the link clicked when an event click rule is fired on clicking of a link on the page . _satellite.setVar('Custom_Hit',str); return true;

and then we assume that the data element i.e %PageName% is  already available on the page to use and then we can write the below custom code in Custom code section of Adobe Analytics Tab in an event based rule.

s.propX=  _satellite.getVar('Custom_Hit') + " : "  + _satellite.getVar('PageName'); s.linkTrackVars=”propX”

Please do let us know if you have any questions or queries.

Thanks & Regards

Parit Mittal