
Affiliate Link Cloaker snippet for MODX Evolution.
Encode urls in base64 and redirect through a blocked page/folder
credits: http://ctrtard.com/affiliate-marketing/better-affiliate-link-cloaking-for-seo/
Install instructions
Create the redirect landing page
- create a new resource with the name of your choice
- add
snippet call[[CloakLinksRedirect]]
- This page must be noindex-nofollow in the robots metatags (*) and/or "Disallowed" in the robot.txt
*I suggest Seo4Evo package to manage Robots index/follow and sitemap exclude in MODx Evolution
Create a Cloaked link (Example calls)
method 1: using a template variable
[[CloakLinks? &landing=`49` &textlink=`site preview` &LinkTv=`AffiliateLink`]]
method 2
[[CloakLinks? &landing=`49` &textlink=`site preview` &LinkWeb=`http://modx.com/`]]
Custom Url Parameter
method 1 + custom url parameter
[[CloakLinks? &landing=`49` &urlparam=`visit` &textlink=`site preview` &LinkTv=`AffiliateLink`]]
Landing page + custom url parameter
[[CloakLinksRedirect? &urlparam=`visit`]]
Parameters:
- &textlink = text placeholder | default value: "Go to the website"
- &targetlink = href target attribute | default value: "_blank"
- &landing = resource id of the landing page for redirect (must contain a
snippet call)[[CloakLinksRedirect]]
- &LinkTv = (method 1) name of the Text template variable containing the affiliate link
- &LinkWeb = (method 2) full affiliate link
- &urlparam = custom parameter url | default value: "goto"
- &ErrorEmptyLink = text placeholder for empty tv and/or missing linkweb parameter | default value: "Empty Link"
- &textlink = text placeholder | default value: "Go to the website"
- &AffiliateSuffix = link suffix for affiliate code (ie: 123456789 or
[*affiliatecodetv*]
) - &urlparam = custom parameter url | default value: "goto"
- &linkelements = allows the addition of extras like class, title etc.
- &dummyparams = "Dummy" parameters e.g.
&dummyparams=`pid=147&alias=cloaklinks&`
Demo CloakLinks snippet for MODX
Link to MODX
[[CloakLinks? &landing=`148` &textlink=`link to modx.com` &LinkWeb=`http://modx.com`]]
Result:
http://www.tattoocms.it/out.html&goto=http://modx.com/
Encoded url:
Link to GIT
[[CloakLinks? &landing=`148` &dummyparams=`pid=
[*id*]
&alias=[*alias*]
&` &textlink=`link to github` &AffiliateSuffix=`/Nicola1971` &LinkWeb=`https://github.com`]]
Result:
http://www.tattoocms.it/out.html&pid=147&alias=cloaklinks&goto=https://github.com/Nicola1971
Encoded url:
Link to Themeforest
[[CloakLinks? &landing=`148` &textlink=`link to themeforest` &AffiliateSuffix=`/comments` &AffiliateSuffix=`?ref=AFFILIATENAME` &LinkWeb=`http://themeforest.net/item/club-cube-responsive-modx-theme-for-night-club/9378054`]]