Due to an increase in the use of adblockers, browsers with tracking prevention and cookie legislation, e-commerce websites miss up to 30% of their marketing attribution data. TraceDock is a first-party data collection service working in parallel to Google Analytics and connecting your conversions to the Facebook Conversion API to improve the data that you measure from your website visitors.
The goal of this package is to simplify the configuration of our Server-side Transaction Tracking service for customers with Lightspeed.
The package includes a Lightspeed module and will:
- Set up the identify event based on the quoteId of the checkout.
- Forward invoice data to the TraceDock endpoint to connect serverside transactions using a webhook.
See https://docs.tracedock.com/configuration/server-side-transaction-tracking/ for documentation about the Server-side Transaction Tracking.
Note: we assume that customers have implemented the basic setup of TraceDock, including adding a DNS record and adding the TraceDock code to the template of the website, as found in https://docs.tracedock.com//installation/start.
This readme contains a step-by-step description of how you can install the module in your Lightspeed environment.
First step is to add the client-side identify event on all checkout pages. This event will allow TraceDock to stitch the transaction to the browser session.
The code of a Lightspeed shop can be modified by navigating to Design > Theme editor > Advanced > Adjust code. In the side bar you can see all the files you can modify in the template. The can be found either in the file 'head.rain' in the folder 'snippets' or 'fixed.rain' under the tab 'layout'.
In this file you can add the dataLayer event within the tags and .
{% if checkout %}
<script>
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({userId: "{{ checkout.quote.id }}"})
</script>
{% endif %}
Note: Lightspeed does not contain a default userId, as such we use the quoteId to stitch with the browser session.
For compatibility with the default templates in TraceDock we will forward this field as userId
.
This file initiates the curl command to post the transaction data from Lightspeed to TraceDock. See the file src/1_tracedock_api.php
in the code.
In this file, three variables above the page (line 6 to 8) must be updated with your shop specific data:
- $url - This is the url of the TraceDock endpoint that can be found in the TraceDock portal under the transaction event.
- $key - This is the Lightspeed API key, accessible by the owner via Settings > Developers.
- $secret - This is the Lightspeed API secret, accessible by the owner via Settings > Developers.
This file initiates the webhook to make the API after the transaction is completed. See the file src/2_createwebhook.php
in the code.
In this file 3 variables above the page (line 4 to 6) must be updated with your shop specific data:
- $url - This is the URL of the file you created under step 2a, called
tracedock.php
. - $key - This is the Lightspeed API key, accessible by the owner via Settings > Developers.
- $secret - This is the Lightspeed API secret, accessible by the owner via Settings > Developers.
After these files are initiated, all orders with the status paid
will be automatically forwarded to TraceDock.
You can debug these events within the TraceDock user portal. Go to serverside_events tab in the TraceDock user portal. Press on the three dots (...) next to the event, and you will automatically filter the transactions in the live event view.
If you have any questions, please contact us on [email protected]. We love to help.
No known issues.
See the Changelog
See the Contribution Guidelines