Tracking code Not capture the whole code | Community
Skip to main content
Level 2
April 15, 2025
Solved

Tracking code Not capture the whole code

  • April 15, 2025
  • 4 replies
  • 906 views

I'm trying to create a report for the performance of the campaigns we launched last month and some of those campaigns are like this :

?c_code=soc-146-25_02_17_P_H_K_G_SCH#7835

somehow I can only see in the hit everything till the # and nothing else. 

so I'm confused is it because the tracking code not tracking the special characters? or something missing?

 

and is there a characters limit for the tracking code dimension?

Thanks

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by uni-adam

You could encode "#" to “%23” so that the entire campaign code is transmitted otherwise it gets stripped by the browser before send to the server (AA). 

https://developer.mozilla.org/en-US/docs/Web/URI/Reference/Fragment


I've writtten up another reply to you but couldn't see it appear, apologies if it turns up twice.

4 replies

uni-adam
uni-adamAccepted solution
Level 2
April 15, 2025

You could encode "#" to “%23” so that the entire campaign code is transmitted otherwise it gets stripped by the browser before send to the server (AA). 

https://developer.mozilla.org/en-US/docs/Web/URI/Reference/Fragment


I've writtten up another reply to you but couldn't see it appear, apologies if it turns up twice.

user29588Author
Level 2
April 15, 2025

Thanks for replying!

what do you mean by encode "#" you mean form AA perspective or Implementation perspective?

 

And this encoding process will help me segments those published campaigns already (historical data) or only for future data? 

uni-adam
Level 2
April 16, 2025

Usually '#' is used as an anchor for on-page buttons to link to content on the same page but much lower (or higher) on the page. So my guess is this is why it is never sent with requests. 

 

If you had a campaign that had used # you would have to change it (encode it) to '%23' so it can be picked up by AA. But this is only for future data and not retroactive. Does that make sense to you?

eric-hansen-wgu
Level 2
April 16, 2025

The hash (#) character is a reserved character in URLs that is not considered to be part of the query string. You either have to HTML entities encode that character or manually capture it some other way (via custom Javascript function).

 

Tracking code dimensions (assuming eVar) are limited to 255 characters.

bjoern__koth
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
April 16, 2025

Hi @user29588 

this should be because your tag manager likely captures only the query parameter and not the hash in the URL.

The hash in a URL serves a different purpose and any query parameter value should not contains any hash either.

 

If a hash character is required in a query param value, make sure to encode it properly i.e., in your example it would like this

 

?c_code=soc-146-25_02_17_P_H_K_G_SCH%237835

 

 

https://www.urlencoder.org/

"#" translates into "%23"

Cheers from Switzerland!
Jennifer_Dungan
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
April 17, 2025

As others have mentioned, the hash is not a part of the query string... however, you don't have to encode the value in your URLs to pick it up.

 

This could could break the expected functionality of the hash, also known as a URL Fragment). If this was actually being used as a URL Fragment.

 

I can't tell if the above implementation is just a mistake, using a reserved character like a # incorrectly as part of the campaign, or if this is actually supposed to provide functionality on the site, to scroll the user to the correct spot on the page for item number 7835... 

 

If there is functionality attached to this, then having the team encode the value would break the website functionality. If there is no functionality, it would be easier to just have the use a different character, as opposed to encoding the value.

 

If you need to collect a hash value in your tracking, you can use JavaScript to get the hash value:

window.location.hash

 

however, unlike query strings which are in pairs (cid=x, or utm_source=y) where the part before the = provides the name of the item, and the value of that particular item appears after the =... hashes/fragments have no such designations... 

 

So if you do start to collect those values, you can't control which ones... 

 

If you need it as part of your campaign, you could only check for the hash/fragment when you have a campaign, and if a value exist, append it into your campaign tracking value.. 

 

However, like all the solutions posted, this would only be a solution moving forward... unless you are tracking the full URL somewhere, and you haven't hit the character limitation on that dimension, in theory you could use a classification rule to extract the hash from the full URL for historical needs.