Tracking embedded and dynamically loaded YouTube videos via Google Tag Manager

Tracking YouTube videos in Google Analytics via Google Tag Manager is not a trivial thing. Previously, I have been using the method proposed by CardinalPath and it works pretty well for most people. However, I needed a bit more flexibility; e.g. I need to track not only embedded videos but also videos loaded dynamically. This could be videos loaded in a lightbox popup. In my case, videos loaded via the Magnific Popup script.

Read more

Nodes disappearing from internal cache in Umbraco

Occasionally some of the sites I have made in Umbraco 4 have pages that are for some reason not in the internal cache. The solution is to run the following command while logged in to Umbraco:

This will republish all pages and put them back into the cache. It can take quite a while if it is a large site.

Read more

Prevent reload with BrowserSync and Laravel

I use BrowserSync with Laravel Elixir and I found that when I use cache busting it reloads the page instead of injecting the CSS into it. This is of course due to the way cache busting works. Still, this is quite annoying. However, there is a really simple solution to the issue. In your master blade template just make a check to see if you are on a local environment like so:

This is half the solution.

Read more

Remove node_modules folder on Windows without errors

I sometimes get errors when I run npm install for my Gulp or Grunt projects. To retry I need to remove the node_modules folder and sometimes that causes problems as when you are on Windows. I had a look around and found a Git repository named rimraf.

To remove a node_modules folder on your system, first install rimraf globally

Then, navigate to the folder just above the folder you want to remove and run

…and the node_modules folder will be removed.

Read more

Create additional databases in Laravel Homestead

It is really easy to ad more databases in Laravel Homested. Simply edit the Homestead.yaml file (in Windows under C:Usersyour-username.homesteadHomestead.yaml)

Under databases add your databases like this:

If you virtual machine is already running navigate to your Homestead folder and run the command  vagrant provision to create the new database(s). If it is not running simply run  vagrant up.

You should now be able to access your new database with the default credentials.

Read more