Populating Site Catalyst variables with URL parameters from outgoing links

Bronze Contributor
Bronze Contributor
Hi, I am trying to pass Querystring parameters from the outgoing links into Site Catalyst variables, is that possible? Thanks Manuel
7 REPLIES 7

Populating Site Catalyst variables with URL parameters from outgoing links

Employee Emeritus

Hello Manuel, There are a few different ways you can do this. Are you using the Tealium Web Companion? If not take a look here https://community.tealiumiq.com/t5/Productivity-Tools/Web-Companion/ta-p/11947 The easiest way would probably be to use the Tealium Web Companion to display all query parameters that are available within the URL and adding them as data sources to your data layer through the companion, then mapping them accordingly in the tag settings either directly to props, evars or using the new data source to build extensions or other logic. If you are going directly through the Tealium IQ then you would need to create a data source with Querystring Parameter as type and then map accordingly. Hope this helps!

Populating Site Catalyst variables with URL parameters from outgoing links

Employee Emeritus
I understand. You may need to work with a Tealium engineer then. Here is a thought - Does the re-direct get called "on-click" - if so, you may be able to create an extension using JS or jQuery that parses through the url (href) and grabs the param value.

Populating Site Catalyst variables with URL parameters from outgoing links

Tealium Employee
Jim is right. As long as the link in an anchor element you can add on onclick event that grabs this.href and parses out the href querystring parameters. They can then be mapped to SC. It's simple in theory but will require custom code to be able to do this. Please contact your AM to discuss this further.

Populating Site Catalyst variables with URL parameters from outgoing links

Employee Emeritus
Manual, It sounds like you want to grab values from the href value (where the link is taking you) of an exit link and pass them in the exit link server call. Is this correct?

Populating Site Catalyst variables with URL parameters from outgoing links

Employee Emeritus
Manuel, On all clicks on a site the doPlugins section of SiteCatalyst s_code will run. It is in this function that you need to handle things like this. It is going to be custom JavaScript, but you should be able to accomplish what you're doing with something like: Lets say the link you click on is taking you to: www.tealium.com?param=somevalue // Check to see what type of link was clicked on if(s.lt(s.eo.toString())=="e"){ // Grab the link URL (href) and break it apart to get the individual query parameters var qs = s.eo.href.split('?'); var qp = qs[1].split('&') // Loop through all query parameters in exit link URL for(var i=0;i-1){ // Set some variable equal to the value of the query param s.eVar75=qp[0].split('=')[1] } } } This code will set eVar75 equal to "somevalue." This is the value that is found in the "param" query string parameter. This will need to be changed slightly to fit your specific needs, but this should get you most of the way there. The s.lt function is a utility function that is baked into the SiteCatalyst library. So you don't need to worry about adding that anywhere. Hope this helps get you going in the right path.

Populating Site Catalyst variables with URL parameters from outgoing links

Employee Emeritus
Manuel, This has to go in the doPlugins function of your SiteCatalyst s_code. The s.lt and s.eo are only available to the SiteCatalyst code so if you're trying to run them outside the scope of SiteCatalyst then you will get the errors. The doPlugins code should be scoped to the SiteCatalyst tag which is why it will work there. If you're having some issues getting it to work, I would reach out to your Account Manager as suggested and one of the Solution Engineers will help you through it. Thanks

Populating Site Catalyst variables with URL parameters from outgoing links

Employee Emeritus
Manuel , You'll need to reach out to your Aacount Manager and they will be able to pull in the correct resource. When you reach out make sure you include a URL and a specific link on the URL where we will be able to test the setup or debug what is currently in place. Thanks
Public