The link click tracking attribute is a snippet of HTML code used to track clicks on links on your website from Connectif.
What is it and how do I use this attribute?
The "data-cn-track-click" attribute can be used on any link that you want to track and that is not part of Connectif content, provided that Connectif JavaScript is installed on the website.
In addition, accompanying the "data-cn-track-click", the "data-cn-alias" attribute can be used to assign an alias to the link to make it easier to identify, for example in the "When web content is clicked" node.
Other considerations
The link click tracking attribute allows you to specify a value to dictate how the tracking mechanism should behave.
1. Async
This value indicates that the mechanism will count the click without blocking navigation. This is the default behavior for links to sections on the same page or special links such as "mailto:" or "tel:".
<a href="#mysection" data-cn-track-click="async">
my section
</a>
2. Sync
This value indicates that the mechanism will count the click before navigating.
<a href="https://www.website.com/product/list" data-cn-track-click="sync">
my products
</a>
3. Track-click
This value indicates that the mechanism will redirect the contact to the destination after tracking. This is the default behavior when the link leads to an external web page.
<a href="https://www.website.com/product/list" data-cn-track-click="track-click">
my products
</a>
4. After-redirect
This value indicates that the mechanism will count the click after having performed the navigation. This is the default behavior when the link leads to an internal page.
<a href="https://www.website.com/product/list" data-cn-track-click="after-redirect">
my products
</a>
Example
Once the attribute is included, it will look different depending on the link type:
-
Internal to the website: links that remain within the website or domain.
<a href="https://www.website.com/product/list" data-cn-track-click>
my products
</a> -
External to the website: links whose destination leaves the website and navigates to other domains.
<a href="https://twitter.com/myprofile" data-cn-track-click>
my profile on twitter
</a>
-
To sections of the same page: links that point to a specific section of the same URL.
<a href="#mysection" data-cn-track-click>
my section
</a> -
Special links: like "mailto:" or "tel:".
<a href="mailto:info@company.com" data-cn-track-click>
contact us
</a>
-
Links with JavaScript code: Links that execute JavaScript code can also be captured. The "data-cn-alias" attribute is required to give names to these links.
<a href="javascript:alert('Hi');" data-cn-track-click data-cn-alias="say-hi">
say Hi
</a>
Keep learning!
To make the most of your Connectif account, we recommend reading these articles next:
- Integration using tags, to discover all the notifications you can send from your ecommerce to Connectif and how they work.
- Integration using JavaScript events, to learn about this type of integration, which give you greater control over when and how to send events.
- Integration with Connectif via API, to synchronize contacts, products, purchases and vouchers.
- Check the integration with your ecommerce, so you can be confident that your data is syncing correctly with your Connectif account.