Skip to content

Instantly share code, notes, and snippets.

View gesteves's full-sized avatar

Guillermo Esteves gesteves

View GitHub Profile
@gesteves
gesteves / instructions.md
Last active October 15, 2021 01:11
Ad loading & analytics exercise

Ad Loading & Analytics Tracker

Hello, and welcome to the technical portion of your interview. Try to complete as much of this exercise as you can before our call, and feel free to use any editors, tools, frameworks, libraries or resources you wish (be prepared to explain why you're using them, though!). We're not looking for a perfect, or even complete, solution; the idea is to have a conversation about how you approached the problem and walk us through your implementation, so please work in whatever environment you feel comfortable using.

The exercise consists in writing a JavaScript system that:

  • Lazy-loads each ad as its container enters the viewport, and
  • Reports stats about the user's visit back to the server
@gesteves
gesteves / nix_utms.js
Created May 27, 2017 16:56
Remove UTM parameters from URL after Google Analytics hit
(function() {
var w = window;
var removeUtms = function () {
var location = w.location;
if (location.search.indexOf('utm_') !== -1 && history.replaceState) {
history.replaceState({}, '', window.location.toString().replace(/(\&|\?)utm([_a-z0-9=\.]+)/g, ''));
}
};
ga('send', 'pageview', { 'hitCallback': removeUtms });
})();