Track Rich Pages With Google Analytics

While Airship messaging supports tracking of rich page opens out of the box, you can also track opens and clicks within Rich PageA landing page or Message Center message in your app that can include HTML, video, etc. content with a third-party tool like Google Analytics. These directions assume you already have created a Google Analytics account.


Configure Google Analytics

  1. Navigate to the Admin page in Google Analytics.
  2. In the Property column, click + Create property, and name it something like “Airship Rich Pages.”
  3. Set the Default URL to
  4. Click Get Tracking ID, then you will see a page displaying the tracking ID.
  5. Note the Tracking ID assigned to this property.

Track Page Opens

To track page opens you need to embed the Google Analytics JavaScript.

If you just completed creating a new property, you will already have this page open, and you can skip to step 4.

  1. Navigate to the Admin page in Google Analytics.
  2. In the Property column, select your property and click Tracking Info then Tracking Code.
  3. Copy the code from the Website tracking section.
  4. Paste the code into every page you want to track. Sample code is below. Make sure to replace YOUR TRACKING ID HERE with your actual tracking ID.
   (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),

   ga('create', 'YOUR TRACKING ID HERE', '');
   ga('send', 'pageview');

It may take several hours before results appear in Google Analytics.

View Page Opens

Because Airship generates a unique URL for each page per user, you will want to first create a filter so that Google Analytics will roll up your URLs to the page level.

  1. Navigate to the Admin page in Google Analytics.
  2. In the View column, click Filters then + Create Filter.
  3. Set the filter so it looks like this:
  4. Click Save.

The filter converts URLs from this format, with user info embedded:

To this, which is how message-level URLs will appear in Google Analytics reports:

  1. Paste this code into every page you want to track:
        function sendLink(choice) {
           ga('send', 'event', 'category', 'action', choice);
           return true;
    You can modify the values of ‘category’ and ‘action’ to organize the information in Google Analytics. See Google’s documentation for more information.
  2. Wire up the event to your event, passing a unique ID to the sendLink() method:
       <a onclick="return sendLink('download');" href="">Download Now</a>

If you are tracking Link Clicks, you can view the events in the Overview or Content sections of the Google Analytics Realtime report.