Wednesday, 29 October 2014

Getting browser history using Javascript

Getting browser history using Javascript

Something we discussed recently at work was using Javascript to obtain the browser history of a user visiting your website. It was deemed a little black-hat but I'm not afraid of such things, so I set about writing a quick script to sniff a user's history.

Why

I read a rumour on the Internet recently that Dell were using such a script to work out whether you've visited competitor websites; allowing them to put their best offers under your nose in an aim to get your business. So under the premise that you've got a website with known competitors, how do you know if your visitor has visited them? That's where my little script would come in handy.

What it does

You enter the URL's of your competitor's websites into a Javascript array and set a colour for visited links in the CSS. Then it's just a case of checking the colour of the A-tags on the page; if you've visited them I'll know about it. So let's start looking at the code...

XHTML

All I've done is create a really basic page that just has a container and a div with the ID of 'sniffer'. This is the div that I'll use for calculating whether various places have been visited. So the code is really basic here:


  1. <body>  
  2.     <div id="container">  
  3.           
  4.         <div id="sniffer">  
  5.               
  6.         </div>  
  7.           
  8.         If all the links remain blue and you don't get an alert box, visit one of the links on the list and refresh the page.  
  9.           
  10.     </div>  
  11. </body>  


  12. Sniffer is empty for now and I've just placed some instructions on the page in case you've not visited any of my test URLs.

    CSS

    The crucial thing to do is ensure that you're setting a color for both a:link and a:visited within the 'sniffer' div, this will ensure we can perform colour checks on them later. So all I've got is:

    1. #sniffer a:link  
    2. {  
    3.     color:#0000FF;  
    4. }     
    5.   
    6. #sniffer a:visited  
    7. {  
    8.     color:#FF0000;  
    9. }  
    10.   
    11. /*#sniffer 
    12. { 
    13.     position:absolute; 
    14.     left:-1000px; 
    15. }*/  


    16. So for regular links I'm telling them to be blue, whereas visited links are going to be red. Note that I've commented out the layout CSS for the #sniffer div; this would position it off-page so that visitors to the page wouldn't be able to see the list I'm checking. However I've commented it out so that (for demonstrative purposes) you can see what I'm checking.

      Javascript

      I'm using Mootools (yet again, no surprises there) for this, although you could do this with straight up prototype (or conventional Javascript probably). The framework doesn't matter too much, I'm just using Mootools because I have it handy and I know the selectors off the top of my head. Let's look at the script:

      1. var competitors = new Array();  
      2.     competitors[0] = 'http://www.dell.com';  
      3.     competitors[1] = 'http://www.google.com';  
      4.     competitors[2] = 'http://www.yahoo.com';  
      5.     competitors[3] = 'http://www.ebay.com';  
      6.       
      7. var visitedPlaces = new Array();  
      8.       
      9. var visitedLink = '#ff0000';  
      10.  
      All I'm doing here is setting up the array of competitors; it can be as many items as you like but in this instance I've used 4 common URLs. I'm then creating an array that will store which links you've actually visited, as well as setting the colour I'm looking for. This colour is the one that we defined in the CSS earlier, note that the hexadecimal characters are lower case, this is important because of how Javascript reads the colour codes for items; it won't match if you leave it uppercase (not without doing a conversion anyway).

      1. window.addEvent('domready'function()  
      2. {     
      3.     var snifferContainer = $('sniffer');  
      4.     var snifferUL = new Element('ul').injectInside(snifferContainer);  
      5.       
      6.     for(var i=0; i<competitors.length; i++)  
      7.     {  
      8.         var snifferLI = new Element('li',{'id':'snifferli'+i }).injectInside(snifferUL);  
      9.         var snifferA = new Element('a', { 'href':competitors[i]}).injectInside(snifferLI);  
      10.         snifferA.innerHTML = competitors[i];  
      11.           
      12.         if(snifferA.getStyle('color') == visitedLink)  
      13.         {  
      14.             var currentPointer = visitedPlaces.length;  
      15.             visitedPlaces[currentPointer+1] = competitors[i];  
      16.             alert(visitedPlaces[currentPointer+1]+' has been visited');  
      17.         }  
      18.     }  
      19. });  
      20.  

      As usual I'm initialising my JS on domready. I'm setting the sniffer container and creating an unordered list HTML element, which I then inject inside of the 'sniffer' div (there's no real need to do this, I just like using UL's to keep my work tidy). I'm then iterating through the competitors array and creating a new list item for each one, with a link to that URL (which are both then injected inside of the UL). I'm then setting the innerHTML of the element so that we can see something on the page (again, no real need to do this because realistically you're not going to show this to the user).

      All I'm doing after that is using the Mootools element.getStyle() function to obtain the 'color' attribute for the A-tag I've just injected. If the link colour matches the hexadecimal item set in the 'visitedLink' variable, then you've visited this URL. All I'm doing at this point is alerting that information out (so you can see it's working) and adding it to the array of visited places.

      Done! Nice, quick and easy but it could come in useful for increasing conversions on your website. It's a little underhand (read unethical) but that's business for you.


Costco shoppers use gift cards to avoid membership fees

Intrepid shoppers have found a loophole to skirt Costco's membership fees.

Costco, a membership-based wholesale retailer, offers discounts for consumers willing to pay an annual fee, which ranges from $55 to $110.

But customers can avoid those fees by paying with a gift card. Only members can purchase the cards, but anyone can use them.

A quick online search turns up blogs and websites that encourage customers to avoid membership fees by using gift cards instead.

Patrons who pay for a membership, like Scott Cowie, say this seems unfair.


"It sounds a bit annoying that I have to pay a membership to Costco and people can just give gift cards and give them to anyone they want without an extra fee being applied," said Cowie.

Cowie thinks the loophole could be abused. He thinks members could charge a small fee in exchange for purchasing the cards for non-members.

A Costco representative told the CBC that people rarely take advantage of the gift card system. If it is, the representative said, the company addresses it.

Consumer advocate Anna Wallner suspects the loophole might not last for much longer.

"I think people will always be looking for the advantage, but eventually if people are taking advantage of the system then I'm sure at some point Costco or whoever the retailer is will change the system," says Wallner.

Wallner says consumers who try to save a few dollars by getting friends or family to buy them Costco gift cards may want to reconsider.

"If you're spending a whole lot of time getting other people to buy gift cards for you, then you need to consider what your time is worth," says Wallner.

Tuesday, 26 August 2014

Was your email read? HOW to find out!

We'll show you how to check if that important e-mail you sent was actually read by the recipient. The process is fairly straight forward and you need to make sure you are using a mail client with HTML turned on.




Here is the link to TAIL MAIL: http://mobileshortcut.com/TAILMAIL/ (then click FREE USAGE).

Once at the site, generate a code and copy the hidden image into the bottom of your email. 


Send off your message and give it some time to be read. You can now paste your unique code into the look-up box and and get up to the minute information on the status of your email.


Wednesday, 29 August 2012

Stalkerish Way To Get Back Links (Sort Of Creepy But It May Work)

I just read the transcript of 8 Link Building Tips – Whiteboard Friday by SEO Moz and wanted share with you one interesting method of getting a popular blogger’s attention and building a relationship with them. From this you may get a mention on their blog with a backlink and guest post opportunities. Here’s what SEO Moz says: This could be a little bit stalkerish, but it’s cool. Amazon have a facility where you can search for other people’s wish lists using their email address. So if there’s a really good blogger who you want to impress, put their email address into Amazon Wish Lists and see if they’ve got one. If they have, maybe send them a gift with a little note saying it’s from your company, you really appreciate the work they do and the blog posts they’re putting out. It’s a great way of building a relationship. They’re going to reply to you. They’re going to say thank you. 

How to do it 

Go to http://www.amazon.com/wishlist (make sure you’re not signed in to your account)

 HAT TIP NICK'S TRAFFIC TRICKS

Monday, 16 July 2012

Find deals on eBay using misspelled auctions tool

Millions of listings are added to eBay every day. Many of them contain typos or misspellings. Savvy eBay buyers and sellers peruse these listings to find deals and inexpensive inventory to resell on eBay.

Here is how it works. Use a tool such as Typohound. Enter the correct spelling of an item or brand name. Let's use Burberry as an example. Typohound will return a list of all possible misspellings and then pop these words into the eBay search engine.

The result - a list of eBay listings that have any variation of the word Burberry. For example, click here to see a Burberry crested blazer up for sale at only $29. The seller has misspelled the brand name BURBERY (missing an R). You could very well purchase this item, have it shipped to you, re-take the photos, list the item, and sell it for $50-$60. (According to HammerTap, the average selling price for a Burberry blazer in EUC condition is $55. This one has the crest, so it will probably go for more.)

How easy is that for finding inventory without leaving home? Misspelling tools are free to use and you can find some incredible deals in the process. Like this tip? Check out Jim Cockrum's My Silent Team for more creative eBay selling strategies

Wednesday, 11 July 2012

Find (Almost) Anybody’s Email Address

With great power, comes great responsibility. 

I’m entrusting this tool to you with the understanding that Distilled readers will use it sensibly.

When doing outreach and linkbuilding, it’s often more effective to be able to send someone an email directly, rather than trying to use a contact form. Instead of hunting through a website to find someone’s email address, this process will speed things up and help you find the address you’re looking for.

(This video contains text, menus and spreadsheet cells worth seeing. I recommend you watch it full screen, and in the highest quality that your internet connection will allow.)

The important things you’ll need for running through this process:
  • A Gmail account, if you don’t have one already
  • The Rapportive plugin from Rapportive.com to get rich contact information inside Gmail
  • The Google Doc spreadsheet at bit.ly/name2email
It’s worth mentioning: this tool ONLY uses publicly available data (Rapportive has a published policy on data and privacy) and it can’t help you find the email address of people who want to keep it hidden.