Categories
Javascript jQuery Quick Tips Resources

Track Outbound Links – Google Analytics

Goal: Use JS to automatically track outbound links that do not have a target=”_blank” attribute – in a dynamic and informative way.

Earlier in the week I was tasked with implementing Google’s Analytics system onto a fleet of websites that have different hostnames. This created many outbound links that weren’t tracked because they lacked a target=”_blank” attribute. This is a solution for websites using tools such as WordPress – and a plugin will be available eventually.  I’ve created a small snippet of Javascript/JQuery to run through a page, checking for external links – and modifying them to be tracked by Google’s servers with an onClick event. In using jQuery to solve this problem, you need to ensure you load jQuery into your page before running any of my script.

Step 1: Google’s Launch Pad – trackOutboundLink

Google has provided a function for converting a given URL into an event name for use in Analytics found here : https://support.google.com/analytics/answer/1136920?hl=en. This is standard Javascript and does not need to live within a jQuery wrapper. This function needs to be placed in the head of the document and not restricted in it’s runtime by a jQuery document.load() call.

Step 2: Checking URL Against the Hostname

Below we create a new function for comparing if a hostname is within a URL. The function takes ‘a’ and ‘b’ as variables, if unset return false, otherwise return the index position of our ‘b’ variable and check if it’s greater than or equal to index position 0. Greater than 0 means the string was found in our tested URL and will return true. Returning true implies the URL is internal, and can be left as is.

	function urlInternal(a, b) {
			if (!a || !b) {
				return false;
			} else {
			    return a.indexOf(b)>= 0;
			};
	};

Step 3: Checking and Appending Anchors

For each anchor tag on the page, we get the href attribute and run it through our urlInternal function. Note the ! before my function call, if this weren’t here we would be evaluating all of the true statements where we want false (URL is NOT internal) results only. If the URL is external, using Google’s function and some concatenation – we write the new onclick attribute.

	var $hostBaseUrl = window.location.hostname;

	jQuery('a').each(function() {
			var $this = jQuery(this);
			var $url = $this.attr('href'); 

			//console.log($url,$hostBaseUrl,$linkBaseUrl);

			if(!urlInternal($url,$hostBaseUrl)){
				var $linkBaseUrl = $this.prop('hostname');
				var	$linkBaseLocation = "trackOutboundLink('http://" + $linkBaseUrl + "'); return false;";
				$this.attr('onclick',$linkBaseLocation);
				return;
			}
		});

Summary

Somewhere in the head of your page (that you want to change the link onClick of) include this function that we can call each time we find an external link.

	/**
	* Function that tracks a click on an outbound link in Google Analytics.
	* This function takes a valid URL string as an argument, and uses that URL string
	* as the event label.
	*/

	var trackOutboundLink = function(url) {
	   ga('send', 'event', 'outbound', 'click', url, {'hitCallback':
	     function () {
	     document.location = url;
	     }
	   });
	}

Run this script before the function and you should be good to go.

jQuery(document).ready(function(){

	/**$hostBaseUrl saves the current URL's hostname for later use. Eg: on google.ca/happy/two.pdf -> google.ca is our hostname **/
	var $hostBaseUrl = window.location.hostname;

	/**Check if a, b are set variables and then check if b occurs in a - returns true or false because of >= 0**/
	function urlInternal(a, b) {

			if (!a || !b) {
				return false;
			} else {
			    return a.indexOf(b) >= 0;
			};

	};

	/**Scan through all anchor tags on the page and get their href attribute**/
	jQuery('a').each(function() {
			var $this = jQuery(this);
			var $url = $this.attr('href'); 

			/**If the link is NOT internal, get it's hostname and call Google's function to write the onclick attribute**/
			if(!urlInternal($url,$hostBaseUrl)){
				var $linkBaseUrl = $this.prop('hostname');
				var $linkBaseLocation = "trackOutboundLink('http://" + $linkBaseUrl + "'); return false;";
				$this.attr('onclick',$linkBaseLocation);
				return;
			}
	});
});
Categories
Constant Contact Marketing Quick Tips

Constant Contact – “parsererror: SyntaxError: Unexpected token <"

parsererror: SyntaxError: Unexpected token <

I ran into this error earlier today while working with a marketing client and was frustrated for a few minutes before discovering a simple solution.

The error is called when more than one tab of Constant Contact is open in your browser.

The simple solution is to close any other open Constant Contact tabs leaving a single instance running in your browser. A refresh of the page may be necessary to remedy the issue.

Categories
Photo Editing Photography

Small Changes Affect Photos in a Big Way

A quick photo shoot with one of the developers I spend a lot of time with yielded an interestingly washed out photo. The original shot is obvious from the set below, it’s in full colour and trying to focus on subject’s iris; while casting harsh contrasting symmetrical light.

Two LED flood lights were used to light the subjects face on either side, down from a 50 degree angle. These lights provided heavy shadows around the eyes, and mouth while leaving the nose otherwise washed out. In order to bring out the details hidden in the shadows, a lens mounted ring flash was used.

Categories
Design

Free Desktop Wallpapers

I’ve been dying to get some photoshop compositing practice in, and wanted to share some desktop backgrounds I created during some design exercises. All of the geometric elements in the gallery below were crafted in Adobe Illustrator CC and composited in Photoshop CC.

Categories
Quick Tips

Facebook Insights not Available for Community Pages?

There is a simple fix:

  1. Go to the admin panel
  2. Click on “edit page”
  3. Click on “update page info”
  4. Click on the word “Category”
  5. Choose your appropriate new category.
Categories
Apache Hacking Open Source Software

Heartbleed Affected Websites List

Source: http://mashable.com/2014/04/09/heartbleed-bug-websites-affected/?utm_cid=mash-com-fb-main-link

See my other post for more info on the Heartbleed Exploit.

Social Networks

Was it affected? Is there a patch? Change your password? What did they say?
Facebook Unclear Yes Yes “We added protections for Facebook’s implementation of OpenSSL before this issue was publicly disclosed. We haven’t detected any signs of suspicious account activity, but we encourage people to … set up a unique password.”
Instagram Yes Yes Yes “Our security teams worked quickly on a fix and we have no evidence of any accounts being harmed. But because this event impacted many services across the web, we recommend you update your password on Instagram and other sites, particularly if you use the same password on multiple sites.”
LinkedIn No No No “We didn’t use the offending implementation of OpenSSL in www.linkedin.com or www.slideshare.net. As a result, HeartBleed does not present a risk to these web properties.”
Pinterest Yes Yes Yes “We fixed the issue on Pinterest.com, and didn’t find any evidence of mischief. To be extra careful, we e-mailed Pinners who may have been impacted, and encouraged them to change their passwords.”
Tumblr Yes Yes Yes “We have no evidence of any breach and, like most networks, our team took immediate action to fix the issue.”
Twitter No Yes Unclear Twitter wrote that OpenSSL “is widely used across the internet and at Twitter. We were able to determine that [our] servers were not affected by this vulnerability. We are continuing to monitor the situation.” While reiterating that they were unaffected, Twitter told Mashable that they did apply a patch.

Other Companies

Was it affected? Is there a patch? Do you need to change your password? What did they say?
Apple No No No “iOS and OS X never incorporated the vulnerable software and key web-based services were not affected.”
Amazon No No No “Amazon.com is not affected.”
Google Yes Yes Yes* “We have assessed the SSL vulnerability and applied patches to key Google services.” Search, Gmail, YouTube, Wallet, Play, Apps and App Engine were affected; Google Chrome and Chrome OS were not.

*Google said users do not need to change their passwords, but because of the previous vulnerability, better safe than sorry.

Microsoft No No No Microsoft services were not running OpenSSL, according to LastPass.
Yahoo Yes Yes Yes “As soon as we became aware of the issue, we began working to fix it… and we are working to implement the fix across the rest of our sites right now.” Yahoo Homepage, Yahoo Search, Yahoo Mail, Yahoo Finance, Yahoo Sports, Yahoo Food, Yahoo Tech, Flickr and Tumblr were patched. More patches to come, Yahoo says.

Email

Was it affected? Is there a patch? Do you need to change your password? What did they say?
AOL No No No AOL told Mashable it was not running the vulnerable version of the software.
Gmail Yes Yes Yes* “We have assessed the SSL vulnerability and applied patches to key Google services.”

*Google said users do not need to change their passwords, but because of the previous vulnerability, better safe than sorry.

Hotmail / Outlook No No No Microsoft services were not running OpenSSL, according to LastPass.
Yahoo Mail Yes Yes Yes “As soon as we became aware of the issue, we began working to fix it… and we are working to implement the fix across the rest of our sites right now.”

Stores and Commerce

Was it affected? Is there a patch? Do you need to change your password? What did they say?
Amazon No No No “Amazon.com is not affected.”
Amazon Web Services (for website operators) Yes Yes Yes Most services were unaffected or Amazon was already able to apply mitigations (see advisory note here). Elastic Load Balancing, Amazon EC2, Amazon Linux AMI, Red Hat Enterprise Linux, Ubuntu, AWS OpsWorks, AWS Elastic Beanstalk and Amazon CloudFront were patched.
eBay No No No “eBay.com was never vulnerable to this bug because we were never running a vulnerable version of OpenSSL.”
Etsy Yes* Yes Yes Etsy said that only a small part of its infrastructure was vulnerable, and they have patched it.
GoDaddy Yes Yes Yes “We’ve been updating GoDaddy services that use the affected OpenSSL version.” Full Statement
Groupon No No No “Groupon.com does not utilize a version of the OpenSSL library that is susceptible to the Heartbleed bug.”
Nordstrom No No No “Nordstrom websites do not use OpenSSL encryption.”
PayPal No No No “Your PayPal account details were not exposed in the past and remain secure.” Full Statement
Target No No No “[We] launched a comprehensive review of all external facing aspects of Target.com… and do not currently believe that any external-facing aspects of our sites are impacted by the OpenSSL vulnerability.”
Walmart No No No “We do not use that technology so we have not been impacted by this particular breach.”

Videos, Photos, Games & Entertainment

Was it affected? Is there a patch? Do you need to change your password? What did they say?
Flickr Yes Yes Yes “As soon as we became aware of the issue, we began working to fix it… and we are working to implement the fix across the rest of our sites right now.”
Hulu No No No No comment provided.
Minecraft Yes Yes Yes “We were forced to temporary suspend all of our services. … The exploit has been fixed. We can not guarantee that your information wasn’t compromised.” More Information
Netflix Yes Yes Yes “Like many companies, we took immediate action to assess the vulnerability and address it. We are not aware of any customer impact. It’s a good practice to change passwords from time to time, now would be a good time to think about doing so. “
SoundCloud Yes Yes Yes SoundCloud emphasized that there were no indications of any foul play and that the company’s actions were simply precautionary.
YouTube Yes Yes Yes* “We have assessed the SSL vulnerability and applied patches to key Google services.”

*Google said users do not need to change their passwords, but because of the previous vulnerability, better safe than sorry.

Banks and Brokerages

All the banks we contacted (see below) said they were unaffected by Heartbleed, but U.S. regulators have warned banks to patch their systems.

Was it affected? Is there a patch? Do you need to change your password? What did they say?
Bank of America No No No “A majority of our platforms do NOT use OpenSSL, and the ones that do, we have confirmed no vulnerabilities.”
Barclays No No No No comment provided.
Capital One No No No “Capital One uses a version of encryption that is not vulnerable to Heartbleed.”
Chase No No No “These sites don’t use the encryption software that is vulnerable to the Heartbleed bug.”
Citigroup No No No Citigroup does not use Open SSL in “customer-facing retail banking and credit card sites and mobile apps”
E*Trade No No No E*Trade is still investigating.
Fidelity No No No “We have multiple layers of security in place to protect our customer sites and services.”
PNC No No No “We have tested our online and mobile banking systems and confirmed that they are not vulnerable to the Heartbleed bug.”
Schwab No No No “Efforts to date have not detected this vulnerability on Schwab.com or any of our online channels.”
Scottrade No No No “Scottrade does not use the affected version of OpenSSL on any of our client-facing platforms.”
TD Ameritrade No No No TD Ameritrade “doesn’t use the versions of openSSL that were vulnerable.”
TD Bank No No No “We’re currently taking precautions and steps to protect customer data from this threat and have no reason to believe any customer data has been compromised in the past.”
T. Rowe Price No No No “The T. Rowe Price websites are not vulnerable to the “Heartbleed” SSL bug nor were they vulnerable in the past.”
U.S. Bank No No No “We do not use OpenSSL for customer-facing, Internet banking channels, so U.S. Bank customer data is NOT at risk.”
Vanguard No No No “We are not using, and have not used, the vulnerable version of OpenSSL.”
Wells Fargo No No No No reason provided.

Government and Taxes

Was it affected? Is there a patch? Do you need to change your password? What did they say?
1040.com No No No “We’re not vulnerable to the Heartbleed bug, as we do not use OpenSSL.”
FileYour Taxes.com No No No “We continuously patch our servers to keep them updated. However, the version we use was not affected by the issue, so no action was taken.”
H&R Block No No No “We are reviewing our systems and currently have found no risk to client data from this issue.”
Healthcare .gov No No No “Healthcare.gov consumer accounts are not affected by this vulnerability.”
Intuit (TurboTax) No No No Turbotax wrote that “engineers have verified TurboTax is not affected by Heartbleed.” The company has issued new certificates anyway, and said it’s not “proactively advising” users to change their passwords.
IRS No No No “The IRS continues to accept tax returns as normal … and systems continue operating and are not affected by this bug. We are not aware of any security vulnerabilities related to this situation.”
TaxACT No No No “Customers can update their passwords at any time, although we are not proactively advising them to do so at this time.”
USAA Yes Yes Yes USAA said that it has “already taken measures to help prevent a data breach and implemented a patch earlier this week.”

Other

WordPress

Unclear

Unclear

Unclear

WordPress tweeted that it has taken “immediate steps” and “addressed the Heartbleed OpenSSL exploit,” but it’s unclear if the issue is completely solder. When someone asked Matt Mullenweg, WordPress’ founding developer, when the site’s SSL certificates will be replaced and when users will be able to reset passwords, he simply answered: “soon.”

Was it affected? Is there a patch? Do you need to change your password? What did they say?
Box Yes Yes Yes “We’re currently working with our customers to proactively reset passwords and are also reissuing new SSL certificates for added protection.”
Dropbox Yes Yes Yes On Twitter: “We’ve patched all of our user-facing services & will continue to work to make sure your stuff is always safe.”
Evernote No No No “Evernote’s service, Evernote apps, and Evernote websites … all use non-OpenSSL implementations of SSL/TLS to encrypt network communications.” Full Statement
GitHub Yes Yes Yes GitHub said it has patched all its systems, deployed new SSL certificates and revoked old ones. GitHub is asking all users to change password, enable two-factor authentication and “revoke and recreate personal access and application tokens.”
IFTTT Yes Yes Yes IFTTT emailed all its users and logged them out, prompting them to change their password on the site.
OKCupid Yes Yes Yes “We, like most of the Internet, were stunned that such a serious bug has existed for so long and was so widespread.”
Spark Networks (JDate, Christian Mingle) No No No Sites do not use OpenSSL.
SpiderOak Yes Yes No Spideroak said it patched its servers, but the desktop client doesn’t use a vulnerable version of OpenSSL, so “customers do not need to take any special action.”
Wunderlist Yes Yes Yes “You’ll have to simply log back into Wunderlist. We also strongly recommend that you reset your password for Wunderlist.” Full Statement

Password Managers

Was it affected? Is there a patch? Do you need to change your password? What did they say?
1Password No No No 1Password said in a blog post that its technology “is not built upon SSL/TLS in general, and not upon OpenSSL in particular.” So users don’t need to change their master password.
Dashlane Yes Yes No Dashlane said in a blog post users’ accounts were not impacted and the master password is safe as it is never transmitted. The site does use OpenSSL when syncing data with its servers but Dashlane said it has patched the bug, issued new SSL certificates and revoked previous ones.
LastPass Yes Yes No “Though LastPass employs OpenSSL, we have multiple layers of encryption to protect our users and never have access to those encryption keys.” Users don’t need to change their master passwords because they’re never sent to the server. But passwords for other sites stored in LastPass might need to be changed.
Categories
Apache Hacking Software

OpenSSL’s New Vulnerability – Are Your SSL Keys Safe?

The Heartbleed Bug – has potentially compromised up to 66% of web servers.

TL;DR XKCD

Researchers at Google and a private security firm Codenomicon have a revealed a new vulnerability in the OpenSSL security used by Apache and nginx Web servers. These technologies are so popular, that this issue – dubbed the Heartbleed Bug – has potentially compromised up to 66% of web servers. Noting that these vulnerabilities have been gaping open for nearly two years, as of the 1.0.1g release of OpenSSL. This has left many websites vulnerable, with no way of knowing whether their private keys were compromised during this window.

The Heartbleed bug is not a man-in-the-middle attack. It exploit’s OpenSSL’s handling of TLS’s heartbeat, which is an encrypted portion of the connection. The reason it leaves no traces is not because it can’t be detected, but because it’s just not logged by OpenSSL. Theoretically it could be logged, though there may be too many false positives that diminish any usefulness logging would have.

Attackers apparently also have control (or at least influence) over what 64KB of memory they can capture, and can keep requesting more memory with each heartbeat (so the 64KB limit isn’t that limiting).

Without using any privileged information or credentials we were able steal from ourselves the secret keys used for our X.509 certificates, user names and passwords, instant messages, emails and business critical documents and communication. -Codenomicon

Heartbeat can be disabled in OpenSSL, but only via a recompile – in which case you might as well apply the new patch anyways.

Sources:

http://arstechnica.com/security/2014/04/critical-crypto-bug-in-openssl-opens-two-thirds-of-the-web-to-eavesdropping/

https://blog.torproject.org/blog/openssl-bug-cve-2014-0160

http://blog.existentialize.com/diagnosis-of-the-openssl-heartbleed-bug.html

Categories
Offtopic Tutorials

Broken Digital Pocket Scale – Troubleshooting and Repair

This is an off-beat post, and has nothing to do with websites or the digital world for that matter. I’ll be going through the steps I used to fix a broken pocket scale that was gifted to me – I get a lot of, “If you can fix, it it’s yours” gifts.

This 50.00g digital scale stopped working for an unknown reason, and the top suggestion for fixing these scales is a re-calibration. Unfortunately, this digital scale could not be calibrated – likely a result of the problems it was already having. After further inspection I realized the scale still accurately measured negative values. At this point the, “if it’s broken and destined for the garbage, I had might as well see how it works.” Was running through the back of my head.

Check the video out for a quick little tutorial and walkthrough of how I got my scale back in mostly working order. Step-by-step below.

  1. Remove the top plate of your scale to gain access to the mounting points of the weight surface.
  2. In my case there were two Phillips screws
  3. Flip the scale and remove the battery cover to reveal the second mount point
  4. Remove that pair of screws and set them aside as well
  5. Under where the weigh platform was, flip the sensor bar
  6. Re-attach all components

The kicker is, now when I lift the weighing platform, it shows me a proper positive number – reversing the fix brings the problems back. Does anyone with more knowledge of digital circuitry have an explanation for this rogue resistor?

Categories
Quick Tips

The Resume Carpet Bomb

I have never understood carpet bombing applications, why not go talk to managers and see what thy want to hear before applying? I’ve always had much better success when I go out of my way to see the needs of a company and tailor my applications/resume to their needs.

Fortunately I haven’t had to do this since my teenage years.

Once you have enough industry work under your belt, and a few good connections – you can typically traverse an industry with a good word and strong portfolio.

Categories
Hacking Quick Tips Software Tutorials

Stop Youtube from Asking to Use Your Real Name

UPDATE: Unfortunately, this doesn’t quite work anymore.

So you’re sick and tired of Youtube’s popup asking, “Do you want to use your real name with your Youtube channel?” No? How about the part where when you check ‘no’ and are greeted with, “Okay, we’ll ask you again later.

Here’s my quick tip to keeping your Google account separate from your otherwise anonymous Youtube account.

For this you will need a modern browser like Chrome, Firefox, Safari, etc. (which you should have anyways… please?) and the Ad-Block Plus Extension. It’s simple as far as implementation and will only take a minute after you’ve installed the extension.

How To

Going into your Ad Block Plus settings by right clicking on icon will open a dialog.

ad-block_Chrome

Go to the custom filter list in the options panel and select, “Manually edit filters” and add the line: ||s.ytimg.com/yts/jsbin/www-linkgplusdialog*

Click for a larger view.
Click for a larger view.

Don’t forget to add the “||” as they act as a catch all for http://, https://, and www prefix, which saves you from making three or four rules for one blocking.

Bonus: Block Video Annotations

||youtube.com/annotations_invideo*
Adding the line above to your custom filters will hide annotations in all Youtube videos, even while logged out.