O'Reilly logo

Instant Galleria How-to by Nathan Van Gheem

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Recording image views with Google Analytics (Medium)

This recipe discusses how to track which images are viewed with Google Analytics.

Getting ready

To get us started, we create a new ga-example.html file inside our development directory. Include a couple of sample images so that we can inspect the Google Analytics tracking requests being sent.

The basic HTML structure will look like the following code snippet with the normal Google Analytics code at the bottom of the file:

<!DOCTYPE html> <html lang="en"> <head> <script src="http://code.jquery.com/jquery.min.js"> </script> <script src="../galleria-1.2.8.min.js"></script> <script> /* Galleria initialization */ </script> </head> <body> <!-- Galleria HTML definition --> <div id="galleria" style="height: ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required