Campaign Tracking
Logspot provides robust Campaign Tracking support. Campaign tracking helps to identify and store data from marketing campaigns directly from the URL parameters. This helps to track marketing campaigns via URL parameters. This documentation will guide you through the process and help you understand how campaign tracking works.
Standard Campaign Tracking
Logspot is designed to look for standard UTM (Urchin Tracking Module) parameters and other specific identifiers from ad platforms in the URL.
The key identifiers that the SDK tracks include:
- Google Click Identifier (
gclid
) - Facebook Click Identifier (
fbclid
) - Microsoft Click Identifier (
msclkid
) - Campaign source (
utm_source
) - Campaign ID (
utm_id
) - Campaign medium (
utm_medium
) - Campaign name (
utm_campaign
) - Campaign content (
utm_content
) - Campaign term (
utm_term
)
These identifiers help you determine the sources of your web traffic and the effectiveness of your marketing campaigns.
How it works
In your SdkConfig
object during the initialization of Logspot, you can enable or disable “sticky” campaigns through the stickyCampaigns
property.
When stickyCampaigns
is set to true
, Logspot will remember the campaign parameters from the user’s first visit, and use them for subsequent tracking events, even if the parameters are not present in the URL anymore. This is useful if you want to attribute all user’s actions to the campaign that originally led the user to your website.
When stickyCampaigns
is set to false
, Logspot will only include the campaign parameters that are currently present in the URL in the tracking events.
This feature uses cookies to store campaign data. The lifetime of the cookie can be configured with stickyCampaignsExpirationInSeconds
property. The default lifetime is 7 days.
If you don’t want to use cookies, you can disable them by setting cookiesDisabled
property to true
in SdkConfig
.
Example for JS SDK
Here’s a simple example of initializing Logspot with stickyCampaigns
enabled:
With this configuration, Logspot will remember campaign parameters from a user’s first visit and use them for tracking subsequent events.
Web SDK
Our Web SDK is using sticky campaigns by default (with 7 days expiration time).
Campaign Parameters in Event Metadata
When tracking campaigns using the Logspot SDK, campaign parameters are automatically stored in the metadata of each event. This feature allows you to analyze which campaigns and marketing efforts are leading users to interact with your events.
During the tracking of any event, these parameters are collected and stored in the event’s metadata, making it easy to segment and filter your analytics based on these parameters.
For example, when calling the track
method:
The metadata of the ‘Purchase’ event will include not only the productId
, price
, and currency
, but also any campaign parameters found in the URL.
Campaign Tracking with Cross-Site Cookie Sharing
The Logspot SDK also supports cross-site cookie sharing, which allows you to track users and their campaign data across different subdomains of your site.
Cookie Domain
The SDK provides the cookieDomain
property in the SdkConfig
configuration object which allows you to specify the domain scope of your cookies. If you want to make cookies available across different subdomains, you can set this property to your primary domain (e.g., .yourdomain.com
).
By default, cookies are only available to the domain that created them. This means if you set a cookie on blog.yourdomain.com
, it will not be available on www.yourdomain.com
. However, by setting the cookieDomain
to .yourdomain.com
, you make the cookie available across all subdomains of yourdomain.com
.
Please note that the leading dot before the domain name is crucial for compatibility with older browsers.
Example
Here’s an example of initializing Logspot with cross-site cookies enabled:
With this configuration, Logspot will use cookies that are accessible across all subdomains under yourdomain.com
.
Web SDK
Conclusion
With the campaign tracking feature, Logspot provides a powerful tool for monitoring the effectiveness of your online advertising campaigns. This functionality allows you to identify which marketing strategies are driving traffic to your website, helping you to invest more effectively in successful marketing campaigns.
The cross-site cookie sharing feature in Logspot SDK is a powerful tool for maintaining consistent tracking of users and their activities across different subdomains of your website. This functionality allows you to have a comprehensive understanding of your users’ interactions with your website, making your campaign tracking more effective.
Remember to use this feature wisely and respect user privacy regulations in your region to maintain a trustworthy relationship with your users.