How To Track Link Clicks With Apps Script And Google Sheets

In this post, we’ll explore an easy way to track link clicks on a website using Google Sheets and Apps Script.

This setup is simple and not comparable to the sophisticated event tracking configurations in dedicated analytics software. However, it’s a nice, lightweight alternative that could be useful in limited scenarios. If nothing else, it’s a nice example showing how to create a webhook with Apps Script and Google Sheets to log data.

In this image you can see that when a link is clicked, it’s logged in a Google Sheet with information about the link:

Track link clicks with Apps Script

It uses the rather obscure “ping” attribute of an HTML anchor link, to send a POST request to a listening webhook set up using a Google Sheet and Apps Script.
Continue reading How To Track Link Clicks With Apps Script And Google Sheets

How To Get Fathom Analytics Data Into Google Sheets, Using Apps Script

In this post, we’re going to create a tool that calls the Fathom Analytics API and pastes website traffic data into Google Sheets:

Get Fathom Site Data

But first, a quick backstory:

Earlier this year (2022), Google announced the sunsetting of the old implementation of Google Analytics, in favor of GA4.

At the time I was running the old Google Analytics software, implemented through Google Tag Manager (along with Facebook’s pixel tracker).

It was time for me to update my web analytics software.

But I didn’t want to just shove GA4 into my existing tag manager setup. From what I’d heard, GA4 was difficult to use and way overblown for my needs.

Also, I really wanted to remove the dependency on Tag Manager from my site, because it’s too complex for my use case and I’m not particularly familiar with it. Plus, it’s been years since I’ve used the Facebook analytics pixel so I wanted to get rid of that too. I wanted to improve my site speed, and removing all this javascript would help with that goal.

So I cast around for alternative analytics software and landed on Fathom.

Fathom Analytics is a lightweight, easy-to-use, privacy-focused analytics software that is perfect for my website.

It was ridiculously easy to set up and I’ve been delighted with how easy it is to use. I jump in and can quickly see everything I need to know for my website:

Fathom Analytics Dashboard

Continue reading How To Get Fathom Analytics Data Into Google Sheets, Using Apps Script

How To Connect To The Teachable API With Apps Script

This post explores how to connect to the Teachable API using Apps Script. You can use this setup to return data about your online courses and show it in Google Sheets.

For example, here’s a running 30-day window into the enrollment, engagement, and completion rates of my online courses:

Teachable Data In A Google Sheet

As a creator, it’s super useful to see these sorts of insights. They inform your future strategy and help identify areas of the business to improve. The standard Teachable dashboard is very limited and doesn’t show you this kind of information.

So let’s see how to connect to the Teachable API and create custom data reports.
Continue reading How To Connect To The Teachable API With Apps Script

API Authentication Apps Script Reference

This post is a summary of common authentication protocols for API authentication with Apps Script.

I got fed up digging around in my Drive folder for old scripts to refresh my memory on the syntax, so I created this reference.

It’s not a comprehensive post on how to connect to APIs, instead, it’s a short summary of common protocols for easy reference.(If you’re new to APIs, start with my Apps Script API tutorial for beginners.)

This post looks at four different API authentication methods:

  1. No API authentication
  2. Requires API key in query string
  3. Requires API key in header
  4. OAuth2: Secure API authentication

Continue reading API Authentication Apps Script Reference

How To Wrap Text In Google Sheets

In this post, we’ll look at how to wrap text in Google Sheets so that long strings fit inside cells and can be read easily.

Method 1: Via Format Menu

Select a range of data and go to the menu: Format > Wrapping > Wrap

Wrap Text In Google Sheets Format Menu

Next to the wrap text option, you’ll find the clip option (show on one line and don’t allow any overflow) and overflow option (show on one line and allow to spill into adjacent cells).

Continue reading How To Wrap Text In Google Sheets