Expand my Community achievements bar.

SOLVED

Tracking URL with dynamic value

Avatar

Level 4
Level 4

Hi,

 

Is it possible to capture custom value dynamically for an url that we provide?  Basically, we are looking to use tracking id and a custom value to identify an user behaviour.  For example, is it possible to do something like this in AA?  www.test.ca?cid=122&colour=red   colour=red needs to be dynamically populated.  Is that something that can be done?

 

Thanks

1 Accepted Solution

Avatar

Correct answer by
Community Advisor and Adobe Champion

Technically yes, with the right code... 

 

First off, is both 'colour' and 'red' dynamic? Or just 'red'?

 

If just 'red' is dynamic, this is a lot easier... you can just create a data element using "Query String Parameter" and specifying "colour" as the item:

Jennifer_Dungan_0-1659748497017.png

 

 

However, if 'colour' could also be dynamic, you will need to write custom code to extra and process this from your string... and you will need to determine rules on how you want to collect it.. what if there are more than one parameter provided (?cid=123&colour=red&shape=square), do you want them all concatenated into a comma separate list?

 

The following JS will get ALL querystrings:

var allparams = window.location.search;

allparams will get '?cid=234&colour=red&shape=square'

 

Then you can use JS to process this data how you need it to be processed, and pass that to the prop or evar of your choice.. or into your s.campaigns

 

Maybe you only want cid in s.campaigns, and colour and shape to be somewhere else.. you can use JS to parse out the cid and value, leaving you with extra params to use as you wish.

View solution in original post

6 Replies

Avatar

Correct answer by
Community Advisor and Adobe Champion

Technically yes, with the right code... 

 

First off, is both 'colour' and 'red' dynamic? Or just 'red'?

 

If just 'red' is dynamic, this is a lot easier... you can just create a data element using "Query String Parameter" and specifying "colour" as the item:

Jennifer_Dungan_0-1659748497017.png

 

 

However, if 'colour' could also be dynamic, you will need to write custom code to extra and process this from your string... and you will need to determine rules on how you want to collect it.. what if there are more than one parameter provided (?cid=123&colour=red&shape=square), do you want them all concatenated into a comma separate list?

 

The following JS will get ALL querystrings:

var allparams = window.location.search;

allparams will get '?cid=234&colour=red&shape=square'

 

Then you can use JS to process this data how you need it to be processed, and pass that to the prop or evar of your choice.. or into your s.campaigns

 

Maybe you only want cid in s.campaigns, and colour and shape to be somewhere else.. you can use JS to parse out the cid and value, leaving you with extra params to use as you wish.

Avatar

Level 4
Level 4

Hi @Jennifer_Dungan,

 

Thanks for this.  Are we able to pull that information from a partner site to our data layer.  Basically, we want to provide that url to our partner to implement, but they don't have AA.  Is this doable in that case?

 

Thanks

Avatar

Community Advisor and Adobe Champion

Is the link going from you to your partner site... or coming to your site from a link on your partner site?

 

Basically you can only track what is happening on your own site... this is the purpose of campaign tracking... a partner, or a marketing campaign in Social Media for instance (where you cannot track) links to your site... they add some querystring parameters to the link that is opened on your site, so that you can read them, and track those PVs/Visits/Conversions/etc back to whatever campaign was running off your site.

 

Controversy, I supposed if you are linking out to partner, you could do some fancy code on the exit link to pick up the outgoing campaign (into a custom prop or evar... don't mess up your site's campaign tracking)... 

Avatar

Level 4
Level 4

Hi @Jennifer_Dungan ,

 

The link is coming from partner site to ours as we want to track users who land on our site onwards. 

 

Thanks

Avatar

Community Advisor and Adobe Champion

Ok, then yes...this url.. when your partner posts a link to you (passing in your specified campaign parameters), you will track those campaign values when on your site, when the user enters your site.

 

This User Group Session could help you out: 

https://www.youtube.com/watch?v=j4uHDORaJWY

 

It's all about Campaign Tracking