Integrating your business with Exponea is the first step in getting closer to your customers. After a quick integration, you will immediately see actions that customers do in your business. If you need any assistance in deciding which API is the best for your business, please contact our integration specialist.
This will initialize Exponea with your project token (your unique project identifier) so that every action will be tracked into your project correctly. You can find your project token inside the Project overview by clicking Overview in the left menu. This code must be included in every page where you want to track actions of your customers.
How do I know that I initialized Exponea correctly?
Tracking your first event
Customers in your business do different actions. These actions are called events and by tracking them you gain insights vital for developing the perfect business. To track your first event, you need to copy-paste the following code into an appropriate place in your business.
This will track the event named purchase with the three attributes of item, price and margin_percent to currently identified customer. For example, the attribute price has number value 7.99.
Of course your event doesn’t have to be named purchase and it doesn’t have to have this set of attributes. Other useful examples of events would be registration or added to cart. You can also get creative and make your own events with custom attributes – only you decide what to track about your customers. However, remember that in business analytics, less is more and you want to start with a few basic events only.
Tip: We recommend you to avoid using internal IDs or numbers as values for attributes where string is available. Purchase status ‘canceled’ is much more comprehensible than a purchase status 3.
You can delete events you tracked at any time easily.
Identifying your customers
To know your customers better, you need to identify them with a unique identifier, such as e-mail or username. Copy-paste the following snippet into the code where it is possible to identify the customer for the first time (for example right after login or registration) so that every event the customer creates from this point on will be tracked correctly and directly to him.
This will identify the customer with a username email@example.com. Without identification, events are added to anonymous customers. Please note that you don’t lose any information about these events after you identify the customer – these events will be transferred to a newly identified customer.
Tip: We recommend you to use something unique. It might be your internal database userId or email (in some cases).
Warning: If using caching on your webserver, you need to make sure not to put identifying customer script into this part.
Updating the customer’s profile
In addition to tracked events, every customer in Exponea has a set of attributes. Attributes can be used to contact the customer using a campaign, or to specify the customer in your business more accurately. Copy-paste the following snippet into the code where you want to update customer attributes.
This will update the customer attributes registration_date, email, first_name, last_name and company.
If a customer property doesn’t exist at the time the code is executed, the property will be created. You can create properties as you need them without worrying about their management. If you don’t need them anymore, you can delete them easily.
Please note that if you choose to identify your customer with an email, you still need to specify the customer attribute email. This is needed because of the distinction between identification attributes and the customer email.
This guide should have provided you with all the basics needed to start tracking your first events. We would love to help you get started as soon as possible, so if you have any questions, please contact our integration specialist.
Customizing default tracking
Default tracking behaviour can be adjusted in the
You can also specify custom properties to be emitted with the session_start and session_end events.
You are able to display a Web Layer by calling
showBanner with ID of the specific banner. You can also send parameters to the banner, which can be then accessed by Jinja in the banner js code:
A good practice is to reset customers cookie after a successful logout. You can call
anonymize in order to assign the current tracked user a new cookie. All following events will be tracked under the new cookie.
You can emit custom events when clicking links:
To display the content of your HTML campaign for the current user, use the following code:
If you want to work with HTML yourself, use the
getHtml method instead:
Characters . and $ are not allowed to be used in JSON keys. However, they can be used as values.