Transactions

Tracking transactions lets you use features such as eCommerce analytics, product purchase segmentation, or cart/transaction based automations.

Authentication

Requests to the SDK may require customer authentication. For more details, see this article.

Using Google Data Layer

If you use Google Data Layer, you can connect it with Synerise.

To track transactions, you need to use Universal Analytics enhanced e-commerce or Google Analytics 4 e-commerce.

Important: If you use both versions of Google Analytics, you must choose one of them to use with Synerise. Choosing both or omitting the parameter results in duplicate events in the database.
SR.init({
    "trackerKey":"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
    "dataLayer":dataLayer,
    "gaVersion": "CHOOSE_VERSION"
});

The gaVersion parameter is used to set the Google Analytics version.

  • If you only use one GA version on your website, you don’t need to add this parameter.
  • To send events to Universal Analytics, set the value to UA
  • To send events to Google Analytics 4, set the value to GA4

This solution lets you track events such as the following:

Product added to shopping cart

dataLayer.push({
    'event': 'addToCart',
    'ecommerce': {
        'currencyCode': 'EUR',
        'add': {
            'products': [{
                'name': 'Triblend Android T-Shirt',
                'id': '12345',
                'price': '15.25',
                'brand': 'Google',
                'category': 'Apparel',
                'variant': 'Gray',
                'quantity': 1
            }]
        }
    }
})

Product removed from shopping cart

dataLayer.push({
    'event': 'removeFromCart',
    'ecommerce': {
        'remove': {
            'products': [{
                'name': 'Triblend Android T-Shirt',
                'id': '12345',
                'price': '15.25',
                'brand': 'Google',
                'category': 'Apparel',
                'variant': 'Gray',
                'quantity': 1
            }]
        }
    }
})

Purchase details

dataLayer.push({
    'ecommerce': {
        'purchase': {
            'actionField': {
                'id': 'T12345',
                'affiliation': 'Online Store',
                'revenue': '35.43',
                'tax': '4.90',
                'shipping': '5.99',
                'coupon': 'SUMMER_SALE'
            },
            'products': [{
                    'name': 'Triblend Android T-Shirt',
                    'id': '12345',
                    'price': '15.25',
                    'brand': 'Google',
                    'category': 'Apparel',
                    'variant': 'Gray',
                    'quantity': 1,
                    'coupon': ''
                },
                {
                    'name': 'Donut Friday Scented T-Shirt',
                    'id': '67890',
                    'price': '33.75',
                    'brand': 'Google',
                    'category': 'Apparel',
                    'variant': 'Black',
                    'quantity': 1
                }
            ]
        }
    }
})

Tracking transactions without Google Data Layer

If you’re not integrated with Google Data Layer, you can create your own array variable and connect it to Synerise using the SDK:

SR.init({
    "trackerKey":"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
    "dataLayer": window["syneriseLayer"] = []
});

After this configuration, you can send objects like the ones above to the syneriseLayer variable instead of the dataLayer variable:

syneriseLayer.push({...})
😕

We are sorry to hear that

Thank you for helping improve out documentation. If you need help or have any questions, please consider contacting support.

😉

Awesome!

Thank you for helping improve out documentation. If you need help or have any questions, please consider contacting support.

Close modal icon Placeholder alt for modal to satisfy link checker