So you've created a Slack App, that's awesome. It's pretty likely that you're not getting the right data about traffic and installations from Slack. Learn how to make sure you're tracking everything correctly.
If you are building a B2B product today, it is basically mandatory to have a great Slack App. It’s the primary collaboration tool for companies small and big and enables you to create thoughtful interactions with users in the environment they are working out of all day, every day. Seems like a no brainer right? 🧠
Once you have a Slack App, you can list it in the Slack App Directory, which is a great place to drive new customers to your product. Whether you have a simple integration, or you’re building a “Slack-first” product, the App Directory puts you in front of the hundreds of thousands of companies using Slack every day.
However, there are a couple of tricky, non-obvious "gotchas" about measuring traffic and installations from the Slack App Directory.
Slack by default removes referrer information from all links clicked in Slack, and this includes links from the App Directory. This means when someone clicks the link to visit your site from Slack App Directory listing, it will by default appear as Direct traffic. This isn’t great, because you aren’t able to measure how much awesome traffic you’re getting from the Slack App Directory!
When someone clicks the “Add to Slack” button on your site to authorize Slack, when they land back on your page, the referrer gets set as Slack, which in this case may not be correct! The problem with this is that if someone came from somewhere besides Slack and installed your Slack App, the referrer will be incorrect.
Without being able to track where sign-ups are coming from, you’re basically flying blind 🙈. But have no fear, we’ve figured out a way to solve both of these problems. We’ve set up a nice little system to track installs for our Slack App from both the App Directory (which is one of our best performing channels) and any other channel.
The first step is to add a parameter to your Installation Landing page link in your Slack App Directory listing. This is in Development App -> Settings -> Basic Information.
The key here is adding the ?ref=slack parameter.
You can add this directly to your site or using Google Tag Manager.
Here’s what that looks like:
🎉! There ya go. You will now see traffic hitting your landing page marked correctly in Google Analytics with the referrer “slack.com”. First problem, solved! 🕵️♀️
When someone clicks the “Add to Slack” button on your site, we need to grab the referrer and store it in a state variable in the OAuth URL.
There is probably more than one place where you have an “Add to Slack” button on your site, so we are dynamically setting the URL of that add to Slack button here based on something with the data value: slack-button=clickable, which we set in our HTML of each button. That way we only have to update our URL in one place if it ever changes.
Next, we store the referrer in a state variable, encode it, and append it to our URL dynamically.
Once again this can be added directly to your site or using Google Tag Manager.
Finally, on the landing page where a user ends up after completing authorization, we need to decode the referrer and set it as the official referrer for tracking. This script should only fire on the page a user lands on after adding to Slack. For us, this is a welcome page.
Booya! All of your conversions will now be attributed to the correct referral source, so you’ll finally know where all those great new customers are coming from :), and those pesky marketers can sleep better at night.
Liked this article? Sign up and subscribe for more tips!
Halp’s dev intern Gernene Tan had the opportunity to design and implement a new feature for Halp’s web UI. Gernene reflects on what working on a new feature “the size of a small french fry” taught her about patience and how to be a better engineer.