Expand my Community achievements bar.

The Analytics Community Lens news letter for February 2024 is now here! Come see upcoming events and what's been going on in the community!
SOLVED

Pass property with each custom link call

Avatar

Level 3

Is there a place where I can define a property (prop, evar, products etc.) that I would like to be passed with EACH custom link call (s.tl())? I've tried Custom Page Code but that works only for page view tracking (s.t()).

1 Accepted Solution

Avatar

Correct answer by
Employee

You can place doPlugins in DTM where you host the library of in the customized code part at the end of adobe analytics tool.

Please be aware that if you put s.timestamp, this will manually timestamp the image request and the report suite NEEDS to be timestamp enabled and it will only accept timestamped hits.

View solution in original post

5 Replies

Avatar

Community Advisor

Hi Lukasz,

 

You need to use s.linkTrackVars and s.linkTrackEvents :

https://marketing.adobe.com/resources/help/en_US/sc/implement/link_variables.html

if you initialize these 2 variables in s_code.js or AppMeasurement.js when you load the file then all variables and events listed in these 2 variables AND that have a value will be sent in the image request when you call s.tl().

if you overwrite these 2 variables at any point after the Adobe Analytics file is loaded then different variables might be sent.

You could also use this solution .

I have made an example on github here . I believe not all variables work for H version of the code but all work for AppMeasurement.js version.

Best regards.

 

Alexis Cazes

Senior Technical Support Engineer

Avatar

Level 3

Hi Alexis,

Thank you for your answer. I understand your answer but I believe this is not going to work in my case because I would like to attach a current (=as of time when the custom link event occurs) timestamp to each call (and also copy it to a prop). In other words, what I'm trying to do is to append the current timestamp to s.linkTrackVars at the moment custom link is triggered. This might be for custom links triggered by DTM but also some legacy ones that we still have hardcoded. With s_code, it worked by placing this code within the s_doPlugins function:

/* Timestamp for offline tracking */ s.timestamp = s.prop47 = Math.round((new Date()).getTime()/1000);

Any ideas?

Avatar

Correct answer by
Employee

You can place doPlugins in DTM where you host the library of in the customized code part at the end of adobe analytics tool.

Please be aware that if you put s.timestamp, this will manually timestamp the image request and the report suite NEEDS to be timestamp enabled and it will only accept timestamped hits.

Avatar

Level 3

Thanks Alexis. I will give it a try in the upcoming days. Our report suites are all timestamp enabled.

Avatar

Level 6

have you looked at

s.linkTrackVars and s.linkTrackEvents

that sets up what props, evars and events you want to send through the s.tl calls without needing to define them in the s.tl call itself. It will just take the value that is assumed to be set in the previous s.t call on the page. you can have any number of props/evars/context variables and events go through on the s.tl call when you define those 2 variables before the s.tl call itself.

https://marketing.adobe.com/resources/help/en_US/sc/implement/link_variables.html