Results 1 to 5 of 5

Thread: Removing Facebook tags from querystring

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2017
    Posts
    4

    Removing Facebook tags from querystring

    Hi...I had some VB stuff written for me ages ago. All works fine. But now, when pages from this site are put on Facebook, the Facebook links always append "?fbclid=" and then a massive long string.

    So my URL may from
    http://www.mysite.com/thepage
    to
    http://www.mysite.com/thepage?fbclid...__tn__=-UK-R&c[0]=AT3udzUg6o1Ni-LiWLzfiw1-Fd5nTKf5KLk2o5SYdjfhid3LhpLD7bv7m2pXPyp1ng2x5t-l_a39TtETb7mP4RLzCv1iXK97tXruTpvTfOMJB1hG09ElsmXi6ROrEV-3dOr-DqG4ChB3omzjFtUibtjEHdVyTk33ZGI28BlqNFspgA8i

    And it causes my pages to throw an error.

    Any help appreciated. I'm a real VB noob - I guess what I really need is a bit of script that replaces from ?fbclid= onwards and redirects to the proper URL?

    Thanks if anyone is able to assist!

  2. #2
    Frenzied Member jdc2000's Avatar
    Join Date
    Oct 2001
    Location
    Idaho Falls, Idaho USA
    Posts
    1,941

    Re: Removing Facebook tags from querystring

    Does the first ? in the altered url always indicate the beginning of the part you want removed?

  3. #3
    Frenzied Member PlausiblyDamp's Avatar
    Join Date
    Dec 2016
    Location
    Newport, UK
    Posts
    1,508

    Re: Removing Facebook tags from querystring

    Quote Originally Posted by vgolfer View Post
    Hi...I had some VB stuff written for me ages ago. All works fine. But now, when pages from this site are put on Facebook, the Facebook links always append "?fbclid=" and then a massive long string.

    So my URL may from
    http://www.mysite.com/thepage
    to
    http://www.mysite.com/thepage?fbclid...__tn__=-UK-R&c[0]=AT3udzUg6o1Ni-LiWLzfiw1-Fd5nTKf5KLk2o5SYdjfhid3LhpLD7bv7m2pXPyp1ng2x5t-l_a39TtETb7mP4RLzCv1iXK97tXruTpvTfOMJB1hG09ElsmXi6ROrEV-3dOr-DqG4ChB3omzjFtUibtjEHdVyTk33ZGI28BlqNFspgA8i

    And it causes my pages to throw an error.

    Any help appreciated. I'm a real VB noob - I guess what I really need is a bit of script that replaces from ?fbclid= onwards and redirects to the proper URL?

    Thanks if anyone is able to assist!
    What error is your application throwing?

  4. #4

    Thread Starter
    New Member
    Join Date
    Aug 2017
    Posts
    4

    Re: Removing Facebook tags from querystring

    Quote Originally Posted by jdc2000 View Post
    Does the first ? in the altered url always indicate the beginning of the part you want removed?
    Yes. It always has ?fbclid= and then a long querystring of varying length.

    The site uses the web.config to rewrite URL's.
    So something like http://www.thesite.com/pages/content.asp?pageid=72 may get rewritten to http://www.thesite.com/page-headline. But when Facebook links it on their site, it will be http://www.thesite.com/page-headline?fbclid=.....

    So the page will get redirected to a custom error page as it can't resolve the URL.

  5. #5
    Frenzied Member jdc2000's Avatar
    Join Date
    Oct 2001
    Location
    Idaho Falls, Idaho USA
    Posts
    1,941

    Re: Removing Facebook tags from querystring

    Try something like the following:

    Code:
    strUrlModifier = "?fbclid="
    
    ' set strUrl to whatever data you are getting from FaceBook
    strUrl = "http://www.mysite.com/thepage?fbclid...__tn__=-UK-R&c[0]=AT3udzUg6o1Ni-LiWLzfiw1-Fd5nTKf5KLk2o5SYdjfhid3LhpLD7bv7m2pXPyp1ng2x5t-l_a39TtETb7mP4RLzCv1iXK97tXruTpvTfOMJB1hG09ElsmXi6ROrEV-3dOr-DqG4ChB3omzjFtUibtjEHdVyTk33ZGI28BlqNFspgA8i"
    
    strUrlFixed = Left$(strUrl, Instr(1, strUrl, strUrlModifier) - 1)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width