hash sign in facebook urls - url

I wonder, why facebook.com (hypem.com, etc.) choose a hash sign after domain to path other files. like http://www.facebook.com/#!/reqs.php#event (#!/reqs.php).
What is the reason, and they map them with javascript?

Google explains it here:
http://code.google.com/intl/en-US/web/ajaxcrawling/
http://code.google.com/intl/en-US/web/ajaxcrawling/docs/learn-more.html

Mostly the hash sign is used in urls so that when you visit it, you are taken to specific location in the page without your scrolling manually.

They do it like this so when, for example, you're in photos and you hit the photo Next button. This does an ajax request and gets the next photo. The problem with this is that the request doesn't change the url, and the user won't be able to Bookmark this new url!
So, they use the anchor part of the url to store these query string values.

Related

How to share URL with UTM parameters on WhatsApp

I have given an option to my users to share my website on whatsapp. And I want to know how many users land back on the website using the shared link. Hence, the shared button opens this link:
https://wa.me/919876543210?text=https://www.mywebsite.com?utm_source=whatsapp&utm_medium=share
But this URL considers the end &utm_medium=share as a part of the wa.me URL, and shares only https://www.mywebsite.com?utm_source=whatsapp on WhatsApp. So instead I did this:
https://wa.me/919876543210?text=https://www.mywebsite.com?utm_source=whatsapp%26utm_medium=share
which shares the correct URL on whatsapp: https://www.mywebsite.com?utm_source=whatsapp%26utm_medium=share, but when I open it, the UTM params are not captured by GA.
What is the way out of this loop?
There's a more elegant way of doing it than utm params. Have something like: https://wa.me/919876543210?text=https://www.mywebsite.com?t=wa
See how now it's shorter and more elegant to a user? Now you have two good options.
Make a conditional redirect on your site from any url that has a t=we query param to whatever utm param you want with no restriction.
And even more elegantly: use GTM to parse pageviews where there's a t query parameter set, then make a neat lookup table where the input would be the value of t and the output - whatever you want to name it. Then use that lookup table's value to set your session-level custom dimension in pageviews.
Why a custom dimension and not UTM? Because when using UTMs, you're affecting your attribution. And sessions. You can easily override organic or paid attribution with some meaningless whatsapp attribution. Well, yes, if you don't use attribution at all and you don't care about GA session breakpoints, then sure, UTMs are just easier.
Also, try escaping the &, but not much hope there.

Facebook share button adds param array index

I'm trying to set up a Facebook share button for my Ruby on Rails web app. The share button iframe src syntax is as follows:
//www.facebook.com/plugins/share_button.php?href=<%= url_encode(request.original_url) %>&layout=button&appId=XXXXXXX
The actual current URL this button loads on is:
http://www.scotusmap.com/events?utf8=%E2%9C%93&period=term&terms%5B%5D=Summer+2014&terms%5B%5D=OT+2014&terms%5B%5D=Summer+2015&terms%5B%5D=OT+2015&terms%5B%5D=Summer+2016&terms%5B%5D=OT+2016&terms%5B%5D=Summer+2017&justices%5B%5D=
Note the params terms and justices, which are arrays. So far so good.
I've independently debugged url_encode and request.original_url, which both are working exactly as expected and returning the above URL.
Here's the problem: when Facebook parses this URL, it seems to add indices to the array params in the 'Fetched URL' (i.e. the URL it's actually scraping):
http://www.scotusmap.com/events?utf8=%E2%9C%93&period=term&terms%5B0%5D=Summer+2014&terms%5B1%5D=OT+2014&terms%5B2%5D=Summer+2015&terms%5B3%5D=OT+2015&terms%5B4%5D=Summer+2016&terms%5B5%5D=OT+2016&terms%5B6%5D=Summer+2017&justices%5B0%5D
This is creating an error, so that when someone clicks on the Share button, the page that Facebook's scraper crawls is one that doesn't exist and therefore the metadata is all wrong too.
Anyone run into this issue before and come up with a workaround?

Canonical URL formatting issue causes Facebook to interpret mobile URL as a different URL

I need to format this canonical URL and I cant figure out how! I've looked around the web and this site a lot and I've realized that I need a specific answer.
Problem Description:
My BLOG's desktop view has (say) URL: www.x.com/page.html
The same page in mobile view URL would be: www.x.com/page.html?m=1
Its all good and dandy to this point, but the problem comes when I use facebook comments with this. It parses url based on this: www.x.com/page.html
So, it is identifying ?m=1 in the end of the first URL as an entirely different URL.
i.e
It is treating those two URL as different
Both of them are URL for the same page and I want them to be treated the same
Could anyone provide me a way to check if the loading page is ?m=1 and if it is ?m=1 then remove the ?m=1 when sending it to facebook?
I WOULD GREATLY APPRECIATE IT IF THE SOLUTION IS INLINE if it is not inline, oh well, I just need a solution right now.
Current code snippet used is this:
<fb:comments colorscheme='light' expr:href='data:post.url' expr:title='data:post.title' expr:xid='data:post.id' height='110' width='560'/>
Let me break the question into small parts(incase someone is not a native speaker and wants to help/learn about this problem)
I want to detect if the loading page has ?m=1 in its URL or not. The canonical URL for this is data:post.url applied as
expr:href='data:post.url'
If a ?m=1 is detected from data:post.URL , I want to remove it and send the remaining URL into expr:href= so that both my URLs
are identified the same when my website displays facebook comments.
Click the image link below to look at this image please. This is the same URL but the
comments are being sent to me as if they're from different URLs. I
want them to appear under the same thread.
This is it--> http://i.stack.imgur.com/M7fK2.png
I haven't found this particular answer anywhere and I am hopeful that
some creative solutions will pop out in this site!
In your code
<fb:comments colorscheme='light' expr:href='data:post.url' expr:title='data:post.title' expr:xid='data:post.id' height='110' width='560'/>
Use data:post.canonicalUrl instead of data:post.url
This is the Blogger's layout tag for getting the Canonical URL of a blog post (This will always default to the blogspot.com domain, so there won't be ccTLD issues as well)

Is it possible to trigger a browser's text search in the URL?

I'm imagining putting a search term in the URL # fragment, like say:
http://blah/#__text_search__=art
And when the user pastes this URL into their browser, or clicks on it in e-mail or whatever, it boots up with the search feature activated, like so:
This is not possible via the URL as that's part of the website the user is visiting
If it were possible via URL then the #__text_search__=art would also be sent to the website.
It may or may not be possible via other means but that will likely be in a browser-dependent way.

get page title from previous page

I have one page on my site. This page have big functionality and there are many links from other pages to this page. And I want to know where from user coming to this page. I found UrlReferrer property in Request object, but it contain only url. But, I want page title.
How can I do this?
Thanks.
You could pass it as query string parameter when generating the link.
You can store title in session for every request and then check it.

Resources