- In this video, I'm going to show you
how you can track events into your intercom.com account
with the help of Google tag manager.
All the more, coming up right after this.
(upbeat music)
Alright, back in our intercom account,
we have already set up in Google tag manager,
the base tracking code for intercom,
so you'll be able to identify users
once they log in to their account.
and we have that data available in intercom now,
what we want to do in this tutorial is
fill the activity column here with event tracking.
How would we do that?
Let's go over to the setup guide here
and enter the custom event.
Now, here are two tracking codes
that we might want to use in order to track events.
The first one being, a simple event
where we just send over the track event call,
with the name of the event.
But, if you want to do it a little bit more sophisticated,
we would attach also, some custom data to that event
and you can attach any kind of data
which will help you later on to segment your users better.
Let's try this out.
Let's go with this event call first
and go back to our page and the event
that I want to now track is when
somebody goes to a product page,
this is actually pretty easily done by Google tag manager
because we can identify product pages by their url up here.
Let's go ahead and install this.
Let's go over to Google tag manager,
go on new tag, this would be an
intercom event tag for our product views.
You'll configure this via the custom HTML option
and paste in our code here.
Now this is JavaScript, so we need to
surround it by script tags and we are ready to go.
Now we need to, just rename this event,
let it invite friend to, viewed product page.
That should do it.
Now the only thing that I want to make sure is that
this actually fires after our general tags.
So I give a tag firing priority of one,
now we could also utilize tag sequencing,
functionality, which gets really complicated
and I would recommend to set this up
once you run into any problems where you're not
able to trigger your events correctly.
For now, we'll skip that and go right to the trigger.
Now when do we want to fire this?
This will be fired on a page view event.
So I'm going to page view and product pages.
So as a tag configuration, we'll go with page view
and only on some page views obviously.
These should be when the page path contains product.
Let's save this and save our tag.
We have a tag firing priority of one.
So we would need to have something
higher for our other codes here.
Let's go and change it around,
let's say here, it's 50 the higher the number,
the more priority it has
and on our general page view as well.
Let's make this 50.
Alright, let's save this, refresh our preview
in debug mode and now, visit the page here.
I'm currently logged in, so I'm going to reload this page,
and we see our Intercom event product views is fired.
Now we should see in our platform,
Jon doe here, and we see a new activity
has been recorded in the profile.
If I click on this, you can see other users
who performed this action, which is none at the moment,
let's go back here and unfortunately,
we are not able to see which product
that he actually viewed.
Let's send in some custom information,
so we'll be able to identify this as well.
Let's go over to setup guide, again,
look into our custom events and
look at the information here.
Let's copy that for a second, go over to our
Google tag manager, and again, into the view product
and let's paste that beneath our opening line here.
Which kind of looks like this one up here,
so just go ahead and delete this part and this part,
that should do it, up here needs to be a comma.
So we've sent over an event call,
with the name of this event
and then some custom information.
This custom information is put into key value pairs.
Now we can customize this to our heart's content so
for example, if you wanted to not have the order date
but rather, would have the page path.
You can then put that in as an attribute
and get it filled with our variables.
Let's try this out, let's get rid
of the other information here.
Save this, refresh, get a compiler error,
let's see what's all that about
and apparently, there's one curly bracket too much.
Let's try this now, save this again, refresh.
Now it goes through, let's go over to our demo shot
and go back to the homepage, go to another product here
and we, again have our event called, this time,
go back to our profile here and we see another event
and we have these little dots here,
you can click and expand it and we see
our custom attribute that we sent over.
Now, if you have the information available,
you could also send over the price,
the title of the product, how much was
entered in this box here, anything that let's you
segment your customers later on.
Obviously, this is not a very sophisticated event
that we are sending over.
A very standard interaction when the page loads,
but the power of Google tag manger is really
when we are able to track and tell actions,
such as the Add to cart click.
So how would we do that with Google tag manager?
We have certain triggers available,
let's go through these steps, first of all,
we would need to deploy a generic click trigger
and as a trigger type, we'll choose all elements
as a click element here
and save this.
Refresh our preview in debug mode,
go back to our page, refresh it as well.
And this time I'm going to click
on the Add to cart button with the command key pressed,
this will open up my click and then new tab,
we'll go back to the other tab
in order to see, how variables got filled
in our preview on debug console.
So here we see a GTM click, once I click on this object,
nothing fires just yet, but we can look into the variables.
Now the variables don't have our click variables
in there just yet, so we need to go back
and to just experiment again.
Let's go into the variables first,
and go to the built in configure variables here
and activate our click variables.
That's something you only need to do one time.
Let's refresh our preview in debug mode, refresh our page
and click on the Add to cart click
with the command key pressed
and then we will go back, and now we can
look into our variables and see how that got filled.
We can choose which event here is unique to what I'm doing,
so in our case, it would be Add to cart,
because if I click on anything else on the page,
for example, going to click on this My Account link,
going to have another GTM link click,
but that gets differently filled
and the click text is differently filled
and therefore, with our fifth click here,
we can distinguish that really well.
Let's go ahead and use that in our filter section,
we'll turn our trigger into a specific one.
This will be a click trigger on our Add to cart clicks.
We'll go ahead and change our firing options
from all clicks to some clicks
and choose the variable which we want to filter out
on this element, in our case, it would be click text
and it should contain or equals Add to cart.
You just control this, see again if,
that is what you have, Add to cart,
it actually needs to be small letter,
so let's do that and save it.
Now, what we need to do now is
to attach our trigger to an actual tag.
We want to fire an event, so just going to go
on our product view event and actually copy that.
Alright, and rename that a little bit,
and this will be an Add to cart event.
You can send over the page path as well.
Alright, let's go ahead and define our trigger here,
obviously, we don't want to fly this on the product view,
but rather our Add to cart click.
So this is something we have to define, let's save this,
refresh, refresh our page and we see,
already our product view event.
But when I click on this Add to cart button,
you see down here, that our event click
was fired into this user.
Now, once we go back to our intercom
platform and reload the page,
we see several Add to cart clicks,
that's something I've tried out
beforehand, our product page view.
But again, this is information that only
gets sent over once somebody actually
clicks on the Add to cart button
and it transfers over the page path.
So this is how you can fill up
your activity reports with useful events
that you might use to segment your users later.
Send them a message once they have
performed a certain action and track
that all in the intercom platform.
Obviously, you can customize this to your heart's content,
for example, send in when somebody buys a product,
perform certain action, reaches a certain level
on your platform or completes and exercise.
It totally depends on your platform
itself and is very customizable.
Don't forget, once you're done,
to go over to your Google tag manager account
and actually publish this to all your users.
Go to the submit button, give this version a name,
and publish this to all your users
so it's now live on your website.
So there you have it, this is how
you can install events with the help
of Google tag manager into your intercom account.
Now, if you haven't installed intercom
with Google tag manager yet, then head over
to our first video, which we've done on this series.
If you like this video, then consider
subscribing over there because we'll
bring you new videos every Wednesday.
My name is Julian, till next time.