Skip to content

Analytics & Consent

Gamifiera can track how your customers interact with your site to give you better insights into how Gamifiera helps your store — for example, how our widgets contribute to conversion. To respect your users' privacy and comply with regulations such as GDPR, analytics tracking only happens after the user has given consent.

This guide explains how to pass analytics consent to Gamifiera and how to track completed orders.

Whenever a user gives or rejects consent for analytics (for example, through your cookie/consent banner), call the update method with the user's choice:

javascript
gmf('update', {consent: {analytics: true}});  // consent given
gmf('update', {consent: {analytics: false}}); // consent rejected

Call this every time the consent state changes so Gamifiera always reflects the user's current preference.

If consent has already been given or rejected by the time the widgets load, include it directly in your existing init call:

javascript
gmf('init', {
    merchantId: xxxx,
    locale: 'sv_SE',
    customerToken: 'CUSTOMER_TOKEN',
    consent: {analytics: true}, // or false if the user has rejected
});

ℹ️ Note: Only include the consent object if the user has already made a choice. If consent has not yet been given or rejected, leave the consent object out of the init call entirely. You can send the user's choice later with the update method shown above.

Tracking Orders

When an order has been placed — for example on the post-checkout / order confirmation page — call the trackOrder method:

javascript
gmf('trackOrder', {orderId: ORDER_ID, value: TOTAL_ORDER_VALUE});
ParameterTypeDescription
orderIdstringThe unique identifier of the placed order.
valuenumberThe total order value as a number, without any currency symbol.

⚠️ Warning:value must be a plain number (e.g. 499.00), not a formatted currency string like "499,00 kr" or "$499". If your store handles multiple currencies, convert the value to a single currency of your choice before sending the event so your analytics stay consistent.

Example

javascript
gmf('trackOrder', {orderId: '1001', value: 499.00});