• Resolved Mcinsley

    (@mcinsley)


    The first issue I had to resolve was that of the plugin being blocked by adblock. As someone else on the forum pointed out this can be solved by changing the name of the plugin files.

    Now it is correctly affixing links with the affiliate ID however the geolocation doesn’t seem to be working. This is the main thing I need it for since Amazon is a bit silly when it comes to linking to different versions of the site.

    It is not affixing the affiliate ID to anything other than the .co.uk for me and all other links (.com, .fr, etc) are simply neither being changed to my local .co.uk nor being affixed with the affiliate ID.

    Looks like a very useful plugin but clearly something is not working correctly.

    Also, I am not particularly clear why it adds ‘exec/obidos/ASIN’ into the link as I have not seen anything else use this. Usually it is just /dp/ followed by the ASIN. I modified your script to use this and it still appears to function. To my mind ‘exec/obidos’ looks a bit dodgy. Certainly it would put me off the sale without stripping the link first. Maybe I am just paranoid.

    Lastly I have just noticed that the syntax you use is /affiliate-20 when virtually every affiliate link I have seen uses /?tag=affiliate-20. Some sources online (granted old sources) indicate that the former does not work and that it requires the ?tag= first.

    https://www.ads-software.com/extend/plugins/amazon-affiliate-link-localizer/

Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Author PeteWilliams

    (@petewilliams)

    Hi,

    There were some problems with the third-party geolocation service yesterday, which have now been resolved. It sounds like it was this which was causing you problems. Try again, and if it doesn’t work let me know your site’s address and I can investigate.

    The URL format used it’s Amazon’s original and core product URL structure – everything else is a derivative and I can’t see any reason to change from that which I absolutely know works to less familiar derivatives.

    Pete

    Thread Starter Mcinsley

    (@mcinsley)

    Tried again today with a fresh download. It is only modifying .co.uk links.

    I used a few different proxies from various countries to test a post with a link to every Amazon site. These might just be transparent though and hence wouldn’t change anything. However surely all of the links should have been changed to .co.uk for me when viewing it without any proxies? The only links to be modified with the affiliate bit are .co.uk.

    In regards to the ?tag= bit…
    https://beckism.com/2008/02/amazon_affiliate_links/

    As I said, that is a little old, so it might have been changed by now but every single affiliate link I have found is formatted with the ?tag= before it. I am not convinced that simply using /affiliate works.

    I was playing with another plugin that used the Google location service and it was unable to find my location too. I think due to my ISP. I suspect this is why the links are not changing. However freegeoip.net works when I visit the site so it should be able to get my location from this. I’ll try stripping out the google location part and just using this to see if I can get it to work. I think Google is returning a null value but the script is not using the fallback for whatever reason.

    In regards to the URL format. /dp/ seems to work fine for every site. Personally I would use this as the /exec/ bit has negative connotations and you rarely see it anymore. Doesn’t especially matter but as I said, I am wary of referral links anyway and if I see EXECUTE in the URL where usually I don’t… I might think something suspicious is going on. /dp seems to be what Amazon uses natively now anyway.

    Plugin Author PeteWilliams

    (@petewilliams)

    If you post your URL, I can have a look. I’m in the UK, so can check without using proxies – some people have reported false negatives when using proxies.

    To address your other points:

    • /affiliate does work and always has. My affiliate account would be empty otherwise. I won’t be changing this as I’d need a good reason to go messing with something that I know works.
    • The script does check, fr, it, cn and fr, the code’s just a bit clever than it might appear
    • The script uses both Google and FreegeoIP – if Google returns null, it’ll use freegeoip. Visit https://petewilliams.info/geo.php to confirm what they’re seeing

    Pete

    Thread Starter Mcinsley

    (@mcinsley)

    Yeah sorry, I realised it was checking the other countries, I just skimmed over the line of code.

    I haven’t got the script online right now. It is possible something else is interfering with it anyway.

    Thread Starter Mcinsley

    (@mcinsley)

    Right, cleared out some old plugins which could have been getting in the way.

    https://www.mcinsley.com/books/

    The href on the purple book cover is https://www.amazon.co.uk/dp/ followed by the ASIN.

    The text underneath it is the same but with the .com and the orange cover and link below it are set to .co.uk with my own affiliates ID.

    I have left yours in for the sake of testing. As you can see the .co.uk links are all overridden with the refferal ID correctly but with the .com nothing is happening.

    Plugin Author PeteWilliams

    (@petewilliams)

    Ah, looks like that’s an obscure bug that’s never come up before because of the unusual usecase causing it – it’s because you’ve got two links of the same format, to the same product, but at different counties. The code tries to take shortcuts with duplicate links but in this case it’s got confused because they’re not on the same domain.

    I’ll fix that in the next release, but in the meantime you can get round it by just pointing the links to the same site – it shouldn’t matter if that’s .com or co.uk.

    Pete

    Thread Starter Mcinsley

    (@mcinsley)

    That sounds plausible but doesn’t seem to be the problem in this instance. I have just updated the books page and changed them all to .com

    The ones with my associates ID still maintain it but the other two do not have it attached. None of them are getting switched to the .co.uk either it seems.

    I have also just grabbed two links off amazon.com. The first with it’s full URL and the second changed to exec/obidos/ASIN in case something in the formatting was causing the issue. Neither are getting the affiliate ID attached or changing to .co.uk for me.

    https://www.mcinsley.com/testpage

    Essentially it only seems to be working on .co.uk links.

    Not that I imagine they could be causing a problem but the only other plugins I have installed are Google analytics, Google XML Sitemaps and a social media sharing plugin. Can’t see any reason why these could be causing a problem though.

    The only explanation I can offer is that it is caused by FastHosts. The other day I had a truly bizarre issue in which the 404 page was not displaying. It turned out FastHosts server ignored the first 7,889 characters of the file and hence was reading it as blank. The solution was just to stick a load of characters in before the content of 404.php. This is the kind of illogical nonsense I have to deal with when it comes to FastHosts…

    Plugin Author PeteWilliams

    (@petewilliams)

    OK, found the issue – you’ve got error reporting set to an unusually high level, so it’s showing notices which are messing things up.

    See: https://www.mcinsley.com/wp-content/plugins/amazon-affiliate-link-localizer/ajax.php?strTld=co.uk&strAffiliateId=petewill08-21&strLinks=1400052920|1416941371&strShortLinks

    The default (and recommended) error level is error_reporting(E_ALL ^ E_NOTICE), which excludes notices as they crop up everywhere and are usually nothing to worry about. Try that and it should work fine.

    Thread Starter Mcinsley

    (@mcinsley)

    Ok I am fairly new to PHP so this is rather pushing my knowledge of it now, therefore I may be wrong but…

    The error reporting level is set in php.ini. FastHosts being FastHosts, it does not give the user access to this. It does not surprise me at all that they have set it to an overly high level.

    However according to a couple posts online I should be able to override this for WordPress in wp-config.php. I have just tried to set it to (E_ALL ^ E_NOTICE) but it doesn’t appear to have made a difference.

    It is now set to as off as off gets with:
    @ini_set(‘log_errors’,’Off’);
    @ini_set(‘display_errors’,’Off’);
    @ini_set(‘error_reporting’, 0);
    define(‘WP_DEBUG’, false);
    define(‘WP_DEBUG_LOG’, false);
    define(‘WP_DEBUG_DISPLAY’, false);

    I copied that from the WordPress codex so I assume that it should work. I have reinstalled the plugin but it is still only working on .co.uk links.

    It would not surprise me to find that FastHosts is being weird again and that its settings in php.ini are causing this. I’ll email them to see if they can change the settings. I assume the errors are just measly syntax and formatting matters which shouldn’t cause a problem?

    Plugin Author PeteWilliams

    (@petewilliams)

    They’re not even errors, they’re ‘notices’ which are overinformative and for the most part, useless. In this instance, they’re telling you that I’ve not included an optional parameter – which is deliberate.

    This plugin URL is independent of the core WP code, so changes in wp-config.php won’t have an effect. Try adding error_reporting(E_ALL ^ E_NOTICE); in the actual ajax.php file in the plugin directory, just after the header() lines.

    Thread Starter Mcinsley

    (@mcinsley)

    Ah right, I wasn’t sure where to add the error reporting.

    Adding it to ajax.php has fixed the problem. Also it appears that your script is more than capable of handling links to the same product on different versions of Amazon simultaneously without issue.

    Just added a few different products from different sites to https://www.mcinsley.com/testpage and they all appear to be functioning properly.

    I’ll see if I can find a proxy without transparent settings just to double check but it seems to be solved.

    Do you think this issue was caused by FastHosts php.ini settings then? Might be worth adding that error reporting override to the ajax in the next version if it doesn’t cause other issues/isn’t considered bad practice. Thanks for your help.

    Plugin Author PeteWilliams

    (@petewilliams)

    Great, glad it’s working for you. Yes I think it’s Fasthost’s unusual security settings that caused the problems, but I’ll update the script to work around this in the future.

    Pete

    Thread Starter Mcinsley

    (@mcinsley)

    Posted the link on a forum to have people test it since proxies aren’t especially reliable. Seems to be working everywhere now.

    Odd that you’d see so many downloads and only just stumble upon this issue. Might be because the server is hosted on Windows when most use Linux… I really do need to switch to Linux.

    Thanks again.

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Not working…’ is closed to new replies.