Skip to main content
Skip table of contents

How does the tracking of marketing campaigns work?

Marketing campaigns can be tracked with Piano thanks to specific tagging. This article aims to clarify the tracking possibilities offered by Piano to track marketing campaigns.

Prerequisite

In order for a marketing campaign to be taken into account in Piano Analytics, you need to populate at least the src_medium (Source and Campaign - Type) and src_campaign (Campaign - Name) properties.

Marketing campaign tagging

SDK Piano Analytics

As explained in the Piano Analytics SDK technical documentation, any URL parameter prefixed with at_ will be interpreted as a campaign parameter, and transformed by the SDK into a src_ property within events.

For example, with the following URL

CODE
https://www.site.com/?at_medium=MySource&at_campaign=MyCampaign&at_myproperty=MyValue&at_myotherproperty=MyOtherValue

You'll find the following property/value pairs in your events:

  • src_medium = MySource

  • src_campaign = MyCampaign

  • src_myproperty = MyValue

  • src_myotherproperty = MyOtherValue

Caution, you will need to declare the custom parameters (here, src_myproperty and src_myotherproperty) within your Data Model, and the prefix "src_" is required.

In the case of mobile applications, you'll need to populate the properties (starting with src_) yourself in the tagging, as in this code example.

Mobile applications

In the case of mobile applications, you’ll need to populate the properties (starting with src_) yourself in the tagging. Mobile apps do not automatically parse URL query strings in the same way a web page does; if your acquisition uses deep links, deferred deep links, or other mechanisms, your app must extract campaign values and send them in the first event(s) of the visit.

SmartTag

There are two versions of the tracking to tag marketing campaigns. We advise you to have a SmartTag version higher than 5.17.0 to use the most recent campaign model, as the Piano Analytics SDK does not interpret the older version of our campaigns, which would force you to rework your links the day you would update your site's tagging.

The technical documentation for tracking these campaigns is divided into two parts: native campaign settings, and fully customized campaigns.

Native settings

In the case of native campaign settings, you'll find parameters specific to each type of campaign. These parameters are automatically translated into the right format in the hits, thanks to the value entered in at_medium.

For example, with the following link:

CODE
https://www.site.com/?at_medium=sl&at_platform=google&at_campaign=MyCampaign

The value of at_medium (sl) is automatically recognized by the SmartTag, which will format the campaign information correctly in the hit, such as:

CODE
xto = SEC-[MyCampaign]-goo

Processing rules native to the src_medium property (which retrieves the value pushed into at_medium) also enable this translation, should you push the campaign information yourself from the tag:

Full-custom campaigns

It's also possible to push a completely customized campaign, i.e. with the value of your choice within at_medium and additional URL parameters. All you need to do is having a SmartTag version 5.29.0 or higher, and to put the values of your choice in each parameter.

For example, with the following URL:

CODE
https://www.site.com/?at_medium=MySource&at_campaign=MyCampaign&at_myproperty=MyValue&at_myotherproperty=MyOtherValue

You'll find the following property/value pairs in your events:

  • src_medium = MySource

  • src_campaign = MyCampaign

  • src_myproperty = MyValue

  • src_myotherproperty = MyOtherValue

Caution, you will need to declare the custom parameters (src_myproperty and src_myotherproperty) within your Data Model, and the prefix "src_" is required.

Forcing (overwriting) the marketing source (src_force)

Because marketing source is defined on the first event of the visit, there are situations where you may need to overwrite it:

  • Consent / Hybrid Measurement: if the first event(s) of the visit are sent in exempt mode (before consent), marketing source information may not be stored. When the visitor later accepts your CMP, you can send an event with src_force = true + src_campaign and src_medium to update the marketing source for that visit.

  • “Last campaign wins” alignment: if you want to attribute a visit to the most recently encountered campaign rather than the first one seen in the visit, you can also use src_force + src_campaign and src_medium as part of your strategy.

Implementation guidance:

Send src_force: true on an event triggered by the consent action (often a click or dedicated custom event) to avoid inflating page display metrics and skewing bounce rate analysis.

If the visitor can navigate before consenting, persist the landing URL query string (or store the extracted campaign values) so you can still apply the correct campaign values when sending the forced event.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.