Google Analytics Event Tracking

Installing Google Analytics will automatically track all page views, form submissions, and button clicks.

Make sure you've entered your Google Analytics tracking code in Settings > Advanced > Services. (Do not add Google's default tracking code in Settings > Advanced > Custom Code -- if you've pasted your tracking code there, please remove it, and use this function instead.)

 

In addition to page views, we automatically publish the following events:

1. Form submission - event is triggered whenever a visitor submits a signup form or contact form.

category: 'Action', action: 'EmailCollected'

2. CTA - event is triggered whenever a visitor clicks a button on your site.

category: 'Action', action: 'ButtonClick'

 

Track Custom Events

To add custom events for any other actions on your site, you need to add JavaScript in Settings -> Advanced > Custom Code > Footer Code.

For example, the following code will tell Google Analytics to track all image clicks, by capturing the click event on all ".s-image" elements.

<script>
window._strk = window._strk || [];
_strk.push(function(){
  $('.s-image, .s-media').click(function(){
    var href = $(this).attr('href');
    console.log('Tracking ' + href);
    if (window._gaq) {
      window._gaq.push('_trackEvent', 'Image', 'Click', href);
    }
    if (window.ga) {
      window.ga('send', 'event', 'Image', 'Click', href);
    }
  });
});
</script>

 

Other Third-Party Event Trackers

If you want to publish event to other services such as Mixpanel or Google Adwords conversion, you can subscribe to our event topics and pass in a function that respond to the event. 

var trackingFunc = function() {
window.edit_page.Event.subscribe('topicName', function(topic, data) {
// put your tracking here
});
}

if (typeof _strk != 'undefined') { _strk.push(['Page.didMount', trackingFunc]); } else { window.runAfterDomBinding.add('custom', trackingFunc); }

Available topics:

1. Site.contactForm.submit

Event will be fired when user submits the contact form.

If you are going to track this event for Google Adwords, please see here for sample code.

2. Site.button.click

Event will be fired when user clicked on any CTA button.

If you are going to track this event for Google Adwords, please see here for sample code.


Note: If you have 2 or more forms on your site, there's no way you can differentiate which one the submission has been sent through.

In case you need assistance, shoot us a line at support@strikingly.com or chat with us.

Have more questions? Submit a request