Connecting Google Tag Manager and s2Member

The helpful s2Member Google Analytics page doesn’t cover Google Tag Manager.

If you want to configure GTM with e-commerce transactions, you’ll need to use this code:

Note the  'event' : 'transactionComplete'  line at the bottom. You’re going to use that to make a custom trigger for your e-commerce tracking tag:

The reason for using the custom trigger is that it ensures that the transaction data has been picked up by GTM before the Transaction tag fires. Otherwise you potentially miss the data due to the order of your page load.

The developer guides tell you exactly what variables are required. Standard ecommerce tags have these variables:

Transaction Data

Variable Name Description Type
transactionId (Required) Unique transaction identifier string
transactionAffiliation (Optional) Partner or store string
transactionTotal (Required) Total value of the transaction numeric
transactionShipping (Optional) Shipping charge for the transaction numeric
transactionTax (Optional) Tax amount for the transaction numeric
transactionProducts (Optional) List of items purchased in the transaction array of product objects

Product Data

Variable Name Description Type
name (Required) Product name string
sku (Required) Product SKU string
category (Optional) Product category string
price (Required) Unit price numeric
quantity (Required) Number of items numeric

2 thoughts on “Connecting Google Tag Manager and s2Member

  1. Hi Alan,

    Thank you for publishing it. A quick and, perhaps, stupid question. Where do you put this push code for the data layer to work with S2Member?

    Igor

    1. Anywhere on your site – either in the header or footer. That’s the benefit of the ‘transactionComplete’ event – it doesn’t matter whether the code loads before or after GTM.

Leave a Reply

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