Expand my Community achievements bar.

SOLVED

Query String Parameter

Avatar

Level 2

Hello,

The standard configuration for SC is to strip out query string parameters to a page. This makes sense to record page?cid=test as just /page.

However, we have some pages that require taking in a query string parameter in order to serve up dynamic content. How do we make changes to SC to observe those pages as separate pages?

Example /page?param=1 and /page?param=2 as 2 separate pages. Also is it possible to limit it to such that only the desired param is listed as the link so links like /page?param=1%unwantedparam=2 is only recorded as /page?param=1

My thought is to deploy s.PageName in the custom dynamic content. Any best practices for these kinds of dynamic pages?

Thanks!

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

Hi Ziang, your thoughts are spot-on. The easiest way to do this would be by manually overwriting a page variable with the full URL. Depending on how you want to split up information, you can also use custom variables for additional dimensions:

s.pageName=document.title; s.prop1=document.url;

That would assign the page's friendly name to pageName, and pull the full URL (query string and everything) and assign it to prop1.

View solution in original post

4 Replies

Avatar

Level 5

Hi

Try using JASON array (Hash keys architecture ) for dynamically naming the pagenames.

Create a function before assigning values to the s.Pagename and that specific function consist of JASON which evaluate the query string on basis of parsed parameter and store right value in a variable which could later used  as s.Pagename value.

 

Regards

Devinder

 

 

 

 

Regards

Devinder

Avatar

Correct answer by
Employee Advisor

Hi Ziang, your thoughts are spot-on. The easiest way to do this would be by manually overwriting a page variable with the full URL. Depending on how you want to split up information, you can also use custom variables for additional dimensions:

s.pageName=document.title; s.prop1=document.url;

That would assign the page's friendly name to pageName, and pull the full URL (query string and everything) and assign it to prop1.

Avatar

Level 1

Interesting!! I am going to try this in a prop. I always thought if we set

s.linkLeaveQueryString=true

in s_code.js, we would be able to get the query string parameters. Is that not true? What is that line for in the js file?

Avatar

Level 5

Hi

s.linkLeaveQueryString (true /false)
This variable decides whether to leave or strip URL query in the URL that shows up in the reports. The default value is false.

The parameter linkLeaveQueryString modifies the logic used to determine exit links. When
linkLeaveQueryString=false, exit links are determined using only the domain, path and file portion of the link URL. When linkLeaveQueryString=true, the query string portion of the link URL is also used to determine an exit link.

Regards

Devinder