Can I add Google Analytics to my Knack app?

Danielle Kellogg Updated by Danielle Kellogg

Yes, you can add Google Analytics to your app, though it will require some custom code.

Check out this forum post for how to add Google Analytics to your app.

At the moment Google Analytics will not track page loads or clicks because our pages are dynamically created with JavaScript and page transitions do not reload the actual web page itself. You will need to add actual event triggers for things like clicking a menu item or submitting a form. 

Here's a simple example for logging a form submit using the Knack trigger for record create:

$(document).on('knack-record-create.view_1', function(event, view, record){
ga('send', 'event', 'Form', 'Submit', 'Contact Form');
You can find a list of record events and their parameters in our developer documentation here.

Here's an example for tracking a page view:

$(document).on('knack-page-render.page_1', function(event, page) {
ga('send', 'pageview', 'Page', 'Load', '/addnewcontact');
These require you have the Universal Analytics (analytics.js) version in place. You can read more about Google Event Tracking here and Page Tracking here.


How did we do?

Can I email PDFs or other attachments to users with Knack?

Can I migrate my Access, Filemaker, SQL, or other databases?