Textpattern Forum

You are not logged in. Register | Login | Help

#1 2012-03-09 17:40:02

Pat64
Plugin Author
From: France
Registered: 2005-12-12
Posts: 1,015
Website

pat_referrers

This TXP plugin had been done from my article on the txp-fr community website and a request by Lawrence. It support multiple website inbound links (see list attribute below) with/without individual page (ie. http://domain.com/ sample-page.html) and makes distinction upon domains and sub domain names for referrers.

Purpose

For maketing – or personal – reasons, you could wish to redirect your visitors who come from others websites you made when they click on your TXP personal website Url (inbound links). The only thing you need before using this plugin, is to have your personal TXP website Url on external websites (i.e. http://my-domain.com shown on the textpattern.com website).

Installation & usage

Install this plugin as always in your TXP administration interface, then activate it.
Place the only one tag available in the very top of your TXP “default” page gabarit as this:

<txp:pat_referrers list="" separator="" redirect="" external="" status="" default="" />

TXP tag Attributes

Six attributes are available to make your work:

  • list: String [required] a comma separated list of website Urls (Default: empty).
  • separator: String [optional] separator sign used into the list above to separate each domain names (Default: "," comma)
  • redirect: String [optional] your TXP section name to redirect the referrers listed in the "list" attribute above (Default: empty).
  • status: boolean [optional], if set to 1 a “301 Moved Permanently” status is send. Useful to tell search engine bots that the TXP section must never more to be indexed. Note: in this case, redirect attribute must to be set. Default: 0 (no status send).
  • external: Url [optional] a full external website Url to redirect your visitors Default: empty (i.e. http://google.com as external website address).
  • default: String [optional] your TXP section name for all other visitors they don’t came from websites listed into the "list" attribute above. (Default "" empty = your TXPdefault” main page)

Example

<txp:pat_referrers list="forum.textpattern.com,apple.com" redirect="my-portfolio" default="" />

Note: optional tags can be omitted (blank one). Protocol ‘http://’ can be omitted too.

The example above redirect to your my-portfolio TXP page all vistors who came from the http://forum.textpattern.com or http://apple.com websites where your TXP website Url is shown.

Credits

Many thanks for all TXP plugin creators from whom I learn lot. Special thanks to Jukka Svahn who reviewed this code.
Thanks to Ralitza for the external new feature idea and Colak for the redirect attribute improvement.

Changelog

9 march 2012: v0.1 initial commit.
9 march 2012: v0.2 public version with code reviewed.
02 april 2012: v0.3 accept external attribute for external website Url (Thanks Ralitza ;).
27 april 2012: v0.4 Status attribute added. Redirect attribute accepts empty value for non redirection rendering (Thanks Colak). Help text updated.
28 april 2012: v0.5 Makes distinction upon domain and sub domain names.

Download it here

Some simplifications are made into the code. All previous downloads made ​​before the modification date of this post should be re-uploaded. I apologize for this inconvenience.

Last edited by Pat64 (2012-04-29 07:49:39)


Patrick.
Txp Tricks & Tips by french users : http://txp-fr.net | G+
@Devs : Can’t find the punched tape version of TXP and I need it!
Happy user of TXP 1.0RC1 on a Sinclair ZX spectrum server

Offline

#2 2012-04-02 11:01:24

datorhaexa
Member
From: Düsseldorf, Germany
Registered: 2005-05-23
Posts: 106
Website

Re: pat_referrers

Patrick, a short question: can one give a full url to a different domain for the redirect value?

Offline

#3 2012-04-02 11:52:09

Pat64
Plugin Author
From: France
Registered: 2005-12-12
Posts: 1,015
Website

Re: pat_referrers

Hi Ralitza ;)

No need to give full Url(s) just refer the domain as this example below:

<txp:pat_referrers list="txptips.com,txpmag.com,txp-fr.net" redirect="textpattern-network" default="" />

In the case above, for all your http://www.inkscar.de/ address shown on http://txptips.com or http://txpmag.com or http://txp-fr.net websites, when a visitor click on your website link, he will be redirect on your “textpattern-network” personal page.

For all other visitors, your “default” page (see default attribute) wil be shown (i.e. if visitors come from Google after a search).

This plugin can be useful if you want to target visitors for marketing campaigns (in my case, cause I made lot of “furnished accommodations” websites for my clients, I use it to redirect all my referrers to a special page based on tourism subject).

Cheers,

Last edited by Pat64 (2012-04-02 12:07:30)


Patrick.
Txp Tricks & Tips by french users : http://txp-fr.net | G+
@Devs : Can’t find the punched tape version of TXP and I need it!
Happy user of TXP 1.0RC1 on a Sinclair ZX spectrum server

Offline

#4 2012-04-02 12:17:00

datorhaexa
Member
From: Düsseldorf, Germany
Registered: 2005-05-23
Posts: 106
Website

Re: pat_referrers

:) I thought you might not understand what I mean because of it being a bit unusual. Let me explain: There is one link to my site at a template that I developed a long time ago and is now used on Tumblr. One of the sites my template is used on is not where I would like to get visits from but my url is on it anyway. I was wondering if I could use this plugin to actually send visitors back to say… tumblr. Quite nefarious, I know.

Offline

#5 2012-04-02 12:24:22

Pat64
Plugin Author
From: France
Registered: 2005-12-12
Posts: 1,015
Website

Re: pat_referrers

Oh I see: you want to redirect to… an external website (i.e. tumblr)?
In this case, this plugin can’t… for the moment (it’s an idea, maybe a good one tks ;)
I’ll study this new feature when I’ve got a moment (Sorry, but I’m actually very busy :(


Patrick.
Txp Tricks & Tips by french users : http://txp-fr.net | G+
@Devs : Can’t find the punched tape version of TXP and I need it!
Happy user of TXP 1.0RC1 on a Sinclair ZX spectrum server

Offline

#6 2012-04-02 12:37:16

datorhaexa
Member
From: Düsseldorf, Germany
Registered: 2005-05-23
Posts: 106
Website

Re: pat_referrers

Yes, that’s what I want but it’s no emergency so it can wait. It will be a useful thing to be able to do, though ;)
Thanks for writing back!

Offline

#7 2012-04-02 13:35:49

Pat64
Plugin Author
From: France
Registered: 2005-12-12
Posts: 1,015
Website

Re: pat_referrers

@Ralitza,

I think it is done (v0.3 see first post above): now accept external attribute to specify a full external website Url.
Please test it, and tell me if you’re happy :D

Cheers,


Patrick.
Txp Tricks & Tips by french users : http://txp-fr.net | G+
@Devs : Can’t find the punched tape version of TXP and I need it!
Happy user of TXP 1.0RC1 on a Sinclair ZX spectrum server

Offline

#8 2012-04-02 15:38:15

datorhaexa
Member
From: Düsseldorf, Germany
Registered: 2005-05-23
Posts: 106
Website

Re: pat_referrers

:D Tested and after some fiddling (because I didn’t read carefully) it works! Lovely!
Thanks Patrick!

P.S. Makes me giggle like some evil movie character. I am sending people from a titties&butts site off back to a page with my two Tumblr themes. Talk about being helpful evil grin

Last edited by datorhaexa (2012-04-02 15:44:39)

Offline

#9 2012-04-02 15:55:01

datorhaexa
Member
From: Düsseldorf, Germany
Registered: 2005-05-23
Posts: 106
Website

Re: pat_referrers

Oops. I think there is a problem. I have given in list a location like abc.tumblr.com. Now it seems like it pick any tumblr.com plage and redirects. Do I do things right?

Offline

#10 2012-04-02 16:10:33

Pat64
Plugin Author
From: France
Registered: 2005-12-12
Posts: 1,015
Website

Re: pat_referrers

..So, I’d tried this (which works pretty well):

<txp:pat_referrers list="inkscar.de,textpattern.com" external="http://automotivated.tumblr.com/" />

Could you show us your code (change your tumblr website address if you want)?

(Note: inkscar.de,textpattern.com is an example: I don’t want to show my domain names used)

Last edited by Pat64 (2012-04-02 16:14:52)


Patrick.
Txp Tricks & Tips by french users : http://txp-fr.net | G+
@Devs : Can’t find the punched tape version of TXP and I need it!
Happy user of TXP 1.0RC1 on a Sinclair ZX spectrum server

Offline

Board footer

Powered by FluxBB