Expand my Community achievements bar.

SOLVED

How to remove part of URL

Avatar

Level 1

Hi,

 

For parts of our website  "/#!/" is part of the URL. A decision has been made to remove this going forward and to mitigate the effect on data analysis I wonder if it's possible to remove "/#!/" from both previous and future data points?

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @BillalKh 

historic data cannot be changed without incurring cost. This can be done using the Data Repair API.


For future data, if you are using a Tag Management system like Adobe Launch, I would likely leverage that to remove that part of the URL.

Where/as what exactly do you capture it? As eVars?

 

You can for instance create a custom code data element that returns this

 

return document.URL.replace("/#!/", "")

 

and map it to wherever needed.

Cheers from Switzerland!


View solution in original post

4 Replies

Avatar

Correct answer by
Community Advisor

Hi @BillalKh 

historic data cannot be changed without incurring cost. This can be done using the Data Repair API.


For future data, if you are using a Tag Management system like Adobe Launch, I would likely leverage that to remove that part of the URL.

Where/as what exactly do you capture it? As eVars?

 

You can for instance create a custom code data element that returns this

 

return document.URL.replace("/#!/", "")

 

and map it to wherever needed.

Cheers from Switzerland!


Avatar

Level 9

Hi @BillalKh ,

Assuming that you are tracking the URL value in an AA variable you can try these options,

  • New Data: As @bjoern__koth mentioned you can modify your data collection logic for URL to simply use JS replace function to replace /#!/ string like URL.replace("/#!/", "") for fixing any new data
  • Previous Data: For this you may want to consider one of below options,
    • Permanent update of values in the AA variable: This is something that will require an additional cost as @bjoern__koth mentioned and can be achieved either through data repair API or by engaging Adobe's Engineering Services support
    • Classifications: This option can be used if you don't want to spend money on fixing the parent AA variable. What you can do is create an classification report on top of parent AA variable with cleaned up values. You can do a one time import for all affected values for fixing the entire historical data. Incase your reporting needs are only limited to fix the historical data for upto 6 months in the past (classification rule builder can pick up values upto last 6 months only) or less then you can create a classification rule builder rule to clean up the values for selected period with settings as below,Harveer_SinghGi1_0-1737394035817.png

Cheers!

 

The classification approach will require you to account for all the values without /#!/ in it for both one time import and rule builder where you'd need to pass all such values as it is from parent AA variable to classification.

Avatar

Community Advisor and Adobe Champion

While not a part of the original question, I feel I should point out that having hash (#) in the middle of your URLs is really bad for SEO and you should be aware that any query string parameters (i.e. campaigns) that point to any of those URLs will be lost (unless you have a lot of custom code to extract from from the full URL).

 

Browsers have an expected order of operations... hash tags are normally reserved for named anchors (scrolling to a section on the page), therefore, search engines will not index any URLs past the hash.. this also means that any campaign added after the hash will be considered to be a part of the hash and not a query parameter... 

 

We also have a section like this on our sites and we are working with vendors to fix this, so that we can get rid of the hash, and have these pages function against proper web standards....

 

While I don't worry about removing the hash from the URLs collected in analytics (since I want to be able to copy the URL and go to the page, and the hash is currently part of making the page load), you can use JS to remove the hash from the recorded URL with a little processing of the data. This will not fix any code you have for collecting query parameters though... if those are the "analytics" issue you are referring to... it might fix Marketing Channel processing, but if you are using any Data Elements with Query String Param:

 

Jennifer_Dungan_0-1737395361332.png

 

The issue will not be resolved... 

 

 

In my website, I used the above to get the query params from most pages, then I had to use a JS solution to check on the pages with the badly placed hash.

I had to pull in the whole url, then see if there was a ? in the string, extract the value after the ?, then I had to break that value by &, and manually parse out each of the values.... it was kind of horrible..

 

So I managed to get Analytics working as needed, but couldn't do anything to fix the SEO mess it created....