setVisitorIdFromDeepLink
The setVisitorIdFromDeepLink() method sets the visitor ID from the pk_vid parameter in a deep link URI. This lets you recognize the same visitor on a website and in an app.
Syntax
getTracker().setVisitorIdFromDeepLink(deepLink);tracker.setVisitorIdFromDeepLink(deepLink)Parameters
deepLink (Uri|string, required)
The deep link URI containing the pk_vid query parameter. The pk_vid value must be a valid hexadecimal string with at least 16 characters. Only the first 16 characters are used.
Returns
Whether the visitor ID was successfully set.
Format: True: the visitor ID was set. False: the visitor ID was not set (invalid format, missing parameter, or null input).
Type: Boolean
Examples
To set the visitor ID from a deep link URI:
Tracker tracker = ((PiwikApplication) getApplication()).getTracker();
Uri deepLink = getIntent().getData();
tracker.setVisitorIdFromDeepLink(deepLink);val tracker: Tracker = (application as PiwikApplication).tracker
val deepLink = intent.data
tracker.setVisitorIdFromDeepLink(deepLink)To set the visitor ID from a deep link string:
Tracker tracker = ((PiwikApplication) getApplication()).getTracker();
tracker.setVisitorIdFromDeepLink("https://example.com?pk_vid=0123456789abcdef");val tracker: Tracker = (application as PiwikApplication).tracker
tracker.setVisitorIdFromDeepLink("https://example.com?pk_vid=0123456789abcdef")Related methods
Updated 4 days ago