Tracking Page Visits in WordPress with Intercom.io

I’ve been playing around with intercom.io recently as a way to track activity in apps and have been very impressed with it’s capabilities.  I imagine most people using it are running apps they’ve written so probably do a bit more customized integration, but we’ve been running it in WordPress apps, and it is an incredible tracking tool.  Here is how I do tracking of page visits in WordPress with Intercom.io.

Recently we wanted to track page views logged in member, and I thought I’d share how we did it to make this easy for folks in the future.

First off, I installed Code Insert Manager which is a great little tool that lets you add php and javascript code wherever you want on a page and on any page or set of pages (or all pages) on the site. Also – I should mention if it isn’t obvious, that I’m using the Intercom for WordPress plugin to do the Intercom.io integration in the first place.

Then, I went and activated a new code block sitewide, and put this in there:

That pulls the page slug and records it as an event – nice and simple.

Comments ( 4 )
  • Best Marketing Automation Software Overview - MarketingBoard.biz says:

    […] And although WordPress users have a plugin in the repo, you will still need to customize the code (like in this discussion of how to place Intercom code to fire only on certain membership […]

  • Andre says:

    Great post, exactly what I needed it. Just to add some information, if you are using the plugin Intercom for WordPress, the code from the plugin is inserted in the end of the page. Therefore, when you insert the Js code to track the page, it needs to be after the code from the plugin. Making simple, make sure you add the JS tracking code on footer, otherwise you can get an error “unknown variable: Intercom”

  • Tina Jang says:

    Hello, thanks for your tips. Can I also use this way tracking events in intercom?

    • Justin Handley says:

      Of course – if you look at our code, you’ll see all we are really doing is getting the page name and passing it as an event into Intercom. You can pass any value you want – if you need it to be dynamic, you’d just have to switch out the first block of code to get the value you needed. Also, just as a note, these days I’m using Google Tag Manager as a better solution for including the code.

Leave A Comment

Your email address will not be published. Required fields are marked *