Beantin webbkommunikation

Beantin Beta Blog

Experiments, investigations, and tests of web things
September 18, 2012

Adding Google Analytics to your Tumblr mobile theme

Under the advanced section of the “customize” settings of your Tumblr blog there is the option to “use optimized mobile layout”.

Enabling this gives you a quick, clean, simple mobile version of your site which is shown automatically to mobile visitors.

One thing is lacks is any analytics script. You may have added Google Analytics to your regular Tumblr theme, but that won’t be included in this mobile version.

This means that no visits to your mobile version will be recorded.

The tumblr default mobile theme can’t be customised in the same easy way as your main (desktop) theme can.

To create a customised mobile theme and add Google Analytics, do the following:

  1. Create a new static page called /iphone-theme (it has to be called exactly that)
  2. Choose “Custom layout” as the page type
  3. Copy the default theme from this page on github and paste it in
  4. Add your Google Analytics code snippet just before the end of head section (follow the instructions given in GA)
  5. Make sure “use optimized mobile layout” is ticket in advanced settings

Give it a test and you should pretty soon start to see mobile visitors in your GA reports for your Tumblr site.

Related Posts Plugin for WordPress, Blogger...


Filed under Tumblr.

Tags: , , , ,

  • Eenzaam23

    Brilliant!! Thanks so much-easy enough for a dolt like me to follow!

  • anon

    Awesome! Much thanks. Been scouring the web for this. Will this tracking work for Android and other smartphones as well?

    •  Yes. It will work with any device that has a browser capable of running javascript (read: all smartphones)

  • Nick

    This is fantastic, but it’s the old mobile template that tumblr was using a few months ago. Is there any chance of getting the new template (the one with the white background?)

    • You’re correct, the template I link to is the pre-September 2012 mobile template for Tumblr. The new template suffers from the same problem and lacks GA “out of the box”. Unfortunately, Tumblr haven’t shared the template. We need some kind sole to reverse engineer it again…

  • C

    Thanks so much!! This works beautifully.

  • JL

    Thank you!!!! =)

  • anonnymous

    I don’t know why it won’t work for me. I followed every step. Are there any specific issues to address that might help me solve my problem?

    • The comments here indicate that it worked three months ago – but Tumblr do make changes regularly… If you can’t get it to work, perhaps a better option for you would be to use a responsive theme for your tumblr site and not enable the “use optimized mobile layout” option.

  • anonnymous

    I found my problem. These work for the mobile browser but can I get them to work through the app? I can’t track visits that people search from through the app. Is there any way around that?

  • Jenny

    Does this still work? And where exactly do I have to add my Tracking ID?

    • chewieb

      I had the same two questions. First question: I found that it does not still work, which means the answer to the second question is no longer relevant.

    • Hi Jenny – I don’t think this works any more. I’m not actively using Tumlr right now, so I’m not in a position to check. Sorry!

Theme Beantin created by James Royal-Lawson. Privacy Policy