Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

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 Reply

Avatar

Community Advisor

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.