Piano Analytics gives each visit a single source, defined by the first event of the visit and kept until the visit ends. A conversion is credited to the source of the visit in which it happens. If you need a different source, for example the last campaign a visitor clicked, you can force it with the src_force property.
Default attribution model
The default model works at two levels:
-
Visit source (first touch): the source is defined by the first event of the visit and applies to every event of that visit. A visit ends after 30 minutes of inactivity. The next visit gets its own source.
-
Conversions (last touch): a conversion is credited to the source of the visit in which it happens. Marketing sources are not given priority over organic sources.
For example, a visitor arrives from a search engine at 10:00 and clicks a tagged newsletter link at 10:15. The visit stays attributed to the search engine, because it's still open. The newsletter click is recorded in a click.campaign.offsite event, so you can still count it. If the visitor comes back at 11:00 through the newsletter link and buys, the new visit and the purchase are attributed to the newsletter.
This default model can't be changed. To see how other attribution models would credit your conversions, you have two options:
-
Explorer: go to Explorer > Attribution to analyze your conversions with the attribution model of your choice.
-
Data Query: use attribution directly in your Data Query reports. You choose the metric to attribute, the model (such as first touch, last touch, linear, or U-shaped), the property that receives the credit, and the look-back window. See Attribution in Data Query.
These analyses don't change your stored data.
Force the source of a visit
By default, a campaign that a visitor meets during an open visit doesn't replace the visit source. The src_force property overrides this behavior: it replaces the source of the current visit with the marketing source sent in the event.
To force the source of a visit:
-
Send an event that contains the campaign you want to attribute to the visit.
-
Set
src_medium(Source and Campaign - Type) andsrc_campaign(Campaign - Name). -
Set
src_forceto "true".
pa.sendEvent('click.action', {
'src_medium': 'newsletter',
'src_campaign': 'spring_sale',
'src_force': true
});
The forced source applies to the whole visit, including the events sent before.
If src_medium or src_campaign is missing, the marketing source isn't defined and the campaign is classified as an unclassified campaign. See What are unclassified campaigns?
For the full syntax, including other SDKs, see Force the marketing source of a visit in the developer documentation.
Use cases
-
Last campaign wins: send
src_forceeach time the visitor lands on a tagged link, so the visit is attributed to the last campaign met rather than the first source. This is closer to the Google Analytics attribution model. -
Consent and Hybrid Analytics: if the first events of the visit are sent in exempt mode, the marketing source isn't stored. Send
src_forcewith the campaign values in the event triggered when the visitor accepts your consent banner. Use a click or custom event rather than a page display, to avoid inflating page views and skewing your bounce rate. If the visitor can browse before accepting, keep the campaign values (for example in a persistent query string or in storage) and send them with this event. For more details, see Consent exemption and Hybrid Analytics. -
Server-side tracking: a visitor can click a tagged link during an open visit, so the campaign never becomes the source. Add
src_forceto your event to attribute the visit to that campaign. -
Onsite campaigns: to credit a conversion to the last internal banner clicked instead of the original direct traffic, store the campaign values during the visit and send them with
src_forcewhen the conversion happens. Send it only at that moment, so the source of visitors who don't convert stays unchanged.
Data availability
-
Timing: a forced source is consolidated in your historical data the next day. In real-time data, a visit can temporarily show two sources.
-
No retroactive change:
src_forceapplies to the visits where you send it. It doesn't change past data. -
Campaigns met but not forced: they're still recorded in
click.campaign.offsiteevents. See What is the meaning of the click.campaign.offsite event?