Skip to main content

Track Pageviews and Purchases in Google Analytics

The following steps take place in Google Tag Manager and will result in installing a Google Analytics Tag on Spektrix iframes. Unless otherwise stated, naming conventions of Tags, Triggers, and Variables are up to you; however, for the sake of troubleshooting, we recommend to initially use our suggestions.

Prerequisites
Checklist

By the end of this guide, you will have setup:

  • a Pageview Tag
  • a Purchase Trigger
  • a Purchase Tag

Setup Pageview Tracking

In order to track pageviews in Google Analytics, we will next setup the Google Analytics Tag.

In Google Tag Manager:

  1. Click Tags in the left-hand menu, then the New button. Name the tag Google Tag.
  2. Set the tag to be a Google Analytics > Google Tag
  3. In the Tag Configuration section, add your Google Analytics 4 measurement ID under Tag ID.
  4. Set the Trigger of the tag to be Initialization - All Pages.
  5. Click the Create Tag button to save the tag.

You should now see this tag listed in the Tags section. For more details on making tags, consult the Google Tag Manager documentation.

Setup Purchase Tracking

Step 1: Create the Purchase Trigger

To track transactions, you need create a Custom Event Trigger specifically for Spektrix Transactions. This Trigger is reusable and you can use it to fire any tag when a Spektrix purchase has been made. We will use it below in Step 2 to trigger sending deftault Spektrix transactional infromation to Google Analytics.

In Google Tag Manager:

  1. Click Triggers in the left-hand menu, then the New button.
  2. Name the trigger Spektrix Transaction
  3. Select Custom Event as the Trigger type
  4. Enter Spektrix Transaction as the Event Name
  5. Select All Custom Events for the trigger to fire on.
  6. Click Save to save this trigger.

For more details on making triggers, consult the Google Tag Manager documentation.

Step 2: Create the Google Analytics Transaction Tag

Track transactions on Google Analytics with a Transaction Tag

  1. Click Tags in the left-hand menu, then the New button. Name the tag Google Analytics 4 Purchase.
  2. Set the tag to be a Google Analytics > Google Analytics: GA4 Event tag.
  3. In the Tag Configuration section, add your Google Analytics 4 measurement ID under Tag ID.
  4. In the Event Name input add purchase. Note that this word is written in lower case.
  5. Expand the Event Parameters section, click Add Row and enter the Parameter Name and Value for below:
Property NameValue
currencyThe currency your process orders in 3-letter ISO 4217 format, i.e. GBP, USD, CAD, EUR, AUD
  1. Expand the More Settings section, then the Ecommerce section, check the checkbox for “Send Ecommerce data” and ensure the Data source is set to “Data Layer”
  2. Click on the Trigger section and select the Spektrix Transaction custom event trigger.
  3. Click the Save button on that screen, then click the Create Tag button.

You should now see both tags showing in the Tags section.

For more details on making tags, consult the Google Tag Manager documentation.

Setup Referral Exclusions

In order to see referrals correctly in Google Analytics you need to set up Referral Exclusions in your Google Analytics 4 account. You can do that in Google Analytics (not Google Tag Manager) by following the steps provided by Google.

The domains you setup exclusions for should be:

  • any domains you are tracking (such as myvenue.com)
  • spektrix.com (because of the payment iframe pay.spektrix.com)

Cross domain tracking is not an issue, as the domain of the iframes is the same as that of the parent website.

Test and Publish

Once you are happy with the changes to your Google Tag Manager, you can publish them by clicking the Publish button at the top right of the screen. It’s also possible to preview your site here before publishing, by clicking the dropdown arrow next to Publish and selecting the Preview button.

tip

For testing purposes, note that there's no need to repurchase an entire transaction every single time you make a change: you can refresh a Confirmation page within 20 minutes to check whether changes you’ve made to your Google Tag Manager setup have had the desired effect.