Appearance
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.
Updating Consent
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 rejectedCall this every time the consent state changes so Gamifiera always reflects the user's current preference.
Including Consent During Initialization
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
consentobject if the user has already made a choice. If consent has not yet been given or rejected, leave theconsentobject out of theinitcall entirely. You can send the user's choice later with theupdatemethod 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});| Parameter | Type | Description |
|---|---|---|
orderId | string | The unique identifier of the placed order. |
value | number | The total order value as a number, without any currency symbol. |
⚠️ Warning:
valuemust 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});