Introduction to Segment.io - edit
In order to make this process as easy and flexible as possible, we're going to utilize one of my favorite tools; Segment.io. Segment.io is a tag manager, that allows you to perform frequent adjustments to analytics code only one time, and syndicate the events to all of your analytics and marketing services.
Even if you are only going to use Google Analytics, I highly recommend using Segment.io to set it up. In the future you may want to add additional services, and this will make sure to keep your code well organized and synchronized.
Before we set anything up, let's make an outline of our objectives in this book, and where all of our conversion gates are.
The really important thing to keep in mind, is that not all conversion events are given the same importance. There is one conversion event, the very first
identify call, that is the most important conversion event of them all. That is because it ties our anonymous visitors that are currently being tracked by a cookie, and assigning them a user id. Once we have that user id, we can associate any recurring events that take place on the server (for example a monthly bill is paid) with that User-ID. This allows us to build out a list of the most important metrics, and associate them to a particular channel.
What I mean by that is, you shouldn't consider your funnel "complete" when a user signs up for your service, especially if you have a free trial. Truly your users are finished passing through your funnel when they have canceled their service with you for the very last time.
Enough theory. Let's dive into the practical. The first thing we need to do is install Segment.io on every page of our site/app. Head on over to Segment.io and sign up for an account if you haven't already. Create a new project and grab the tracking snippet that's provided for you. Mine looks like this:
Once you have Segment.io installed on every page of your application, let's turn Google Analytics on to make sure that everything looks good. Navigate to the integrations tab and flick the switch on for GA.
Head on over to Google Analytics and grab your property ID, you're going to want to paste this inside the Google Analytics settings in Segment.io.
I like to turn on Double Click Remarketing, Display Ads, and Demographic Reports to try and slice my user data as fine as possible.
After hitting save and enable, visit your website and check that you can see a visitor in Google Analytics real-time reporting.
If you don't see yourself inside the Google Analytics realtime dashboard then there are 2 possible errors. You have misconfigured the Google Analytics settings inside Segment.io, or worse, you have misconfigured installing the Segment.io tracking snippet. Fortunately Segment.io provides a nifty debugging tool to make sure it isn't the latter.
If you are performing events (pageviews are fine) on your page, and the events aren't showing up, then the error is most likely with your tracking configuration. If the events are showing up, then good news! Your code is probably fine and you have misconfigured Google Analytics. Go back to the settings and make sure there aren't any typos.
Very cool. Go make yourself a margarita. Configuring over 100 service providers just got a whole heck of a lot easier, and more coordinated.