Meta tags:
description= User ID The user ID lets you associate events from various sources with the same user. Each new visitor gets a randomly generated visitor ID that the SDK keeps between app launches. With the user ID you can replace this random identifier with your own - for example an email address or an ID from you…;
Headings (most frequently used words):
sdk, id, app, with, js, api, other, user, and, the, deprecated, tracking, advanced, usage, browser, consent, manager, android, flutter, ios, react, native, integrations, data, activation, email, address, device, visitor, sessions, dispatching, default, custom, variables, name, version, local, storage, limits, anonymization, opt, out, dry, run, sample, rate, url, prefixing, using, swiftui, initializing, tracker, screen, views, onappear, reusable, view, modifier, handling, deep, links, onopenurl, installs, updates,
Text of the page (most frequently used words):
the (96), piwiktracker (49), sharedinstance (49), and (26), with (26), sdk (24), you (24), app (22), swift (21), track (21), user (18), for (17), objective (16), tracking (15), #default (15), can (15), events (15), custom (14), visitor (14), when (14), from (13), use (13), view (12), using (11), url (11), dispatch (11), data (10), not (10), version (9), cross (9), example (9), piwik (9), are (9), new (9), startnewsession (9), advanced (8), usage (8), platform (8), set (8), name (7), variables (7), this (7), string (7), pro (7), some (7), call (7), methods (7), queued (7), setvisitorid (7), screen (6), tracker (6), anonymization (6), device (6), yes (6), one (6), campaign (6), analytics (6), true (6), samplerate (6), optout (6), that (6), visit (6), dispatchinterval (6), modifier (5), onappear (5), swiftui (5), address (5), struct (5), myapp (5), var (5), body (5), web (5), event (5), sendview (5), import (5), only (5), dryrun (5), change (5), than (5), session (5), idfa (5), property (5), manager (5), getting (5), started (5), onopenurl (4), views (4), run (4), local (4), sessions (4), email (4), init (4), site (4), https (4), applicationinstall (4), applicationupdate (4), scene (4), contentview (4), sendcampaign (4), pass (4), does (4), stored (4), isprefixingenabled (4), false (4), your (4), 100 (4), isanonymizationenabled (4), maxnumberofqueuedevents (4), maxageofqueuedevents (4), appname (4), beta (4), appversion (4), includedefaultcustomvariable (4), sessiontimeout (4), enabled (4), visitoridlifetime (4), deviceid (4), audience (4), userid (4), setuserid (4), api (4), deep (3), prefixing (3), opt (3), out (3), storage (3), limits (3), page (3), main (3), siteid (3), baseurl (3), windowgroup (3), runs (3), first (3), send (3), once (3), more (3), parameters (3), incoming (3), uikit (3), next (3), application (3), settings (3), each (3), home (3), instead (3), need (3), before (3), other (3), value (3), sending (3), them (3), queue (3), without (3), deletequeuedevents (3), limit (3), how (3), manually (3), setcustomdimension (3), setcustomvariable (3), requests (3), exception (3), dispatched (3), seconds (3), timeout (3), must (3), asidentifiermanager (3), empty (3), longer (3), content (3), log (3), react (3), trackgoal (3), trackecommerceorder (3), trackecommercecartupdate (3), setvisitoridlifetime (3), setvisitoridfromdeeplink (3), setsessiontimeout (3), setsessionhash (3), setdispatchinterval (3), setanonymizationstate (3), getuseragent (3), getsessionhash (3), checkaudiencemembership (3), ecommerceremovefromcart (3), ecommerceproductdetailview (3), ecommerceorder (3), ecommercecartupdate (3), ecommerceaddtocart (3), docs (3), installs (2), updates (2), handling (2), links (2), reusable (2), initializing (2), sample (2), rate (2), dry (2), dispatching (2), about (2), lifecycle (2), appdelegate (2), most (2), after (2), cfbundleversion (2), cfbundleshortversionstring (2), per (2), see (2), pk_vid (2), link (2), setvisitoridfrom (2), attach (2), attribute (2), urls (2), same (2), itself (2), sends (2), then (2), trackpiwikview (2), form (2), many (2), small (2), single (2), uiapplicationdelegate (2), configure (2), any (2), created (2), ios (2), path (2), flag (2), turn (2), off (2), sendviews (2), generates (2), client (2), sampling (2), number (2), kept (2), server (2), still (2), drop (2), across (2), needs (2), time (2), starts (2), 250 (2), maximum (2), long (2), build (2), 123 (2), formatted (2), variable (2), indexes (2), option (2), recommended (2), automatically (2), scoped (2), eventsperrequest (2), try (2), processcart (2), catch (2), sendexception (2), every (2), preservesessionparameters (2), interactions (2), random (2), dimensions (2), different (2), 0123456789abcdef (2), newvisitorid (2), sources (2), randomly (2), generated (2), between (2), launches (2), sent (2), adsupport (2), advertisingidentifier (2), uuidstring (2), non (2), nil (2), available (2), latest (2), product (2), deprecated (2), identity (2), useremail (2), john (2), doe (2), integration (2), pages (2), native (2), tracksocialinteraction (2), tracksearch (2), trackscreen (2), trackoutlink (2), trackexception (2), trackecommerceremovefromcart (2), trackecommerceproductdetailview (2), trackecommerceaddtocart (2), trackdownload (2), trackcustomevent (2), trackcampaign (2), trackapplicationupdate (2), trackapplicationinstall (2), setuseremail (2), setprefixing (2), setoptout (2), isanonymizationon (2), getvisitorid (2), getuserid (2), sendapplicationdownload (2), audiencemanagergetprofileattributes (2), additem (2), flutter (2), trackcontentinteraction (2), trackcontentimpression (2), outlink (2), download (2), consent (2), management (2), changelog (2), copy, did, help, updated, months, ago, adapter, launch, install, reinstall, again, distinct, bundle, installation, pick, attribution, capture, pk_campaign, pk_keyword, absolutestring, delegate, handle, attached, cleared, open, options, extension, func, settingsview, define, stays, line, vstack, text, hello, world, appears, viewdidappear, uiviewcontroller, standard, callbacks, full, landing, uiapplicationdelegateadaptor, piwikprosdk, simplest, place, initializer, works, both, protocol, lifecycles, section, covers, patterns, xcode, projects, since, prepend, segment, becomes, apis, governed, want, strings, supply, lot, traffic, side, whole, roughly, fraction, approximate, useful, during, development, prints, console, already, uploaded, defaults, restarts, upgrades, persisted, store, location, country, reported, collected, setting, stops, being, 500, age, older, discarded, attempt, backend, accepts, back, dated, hours, reads, fallback, builds, like, override, either, cfbundlename, cfbundledisplayname, yourself, legacy, populate, into, toggle, everything, currently, bulk, post, json, payload, http, backlog, larger, allows, request, several, self, nsexception, sendexceptionwithdescription, reason, description, error, localizeddescription, trigger, manual, immediately, tracked, temporarily, batches, behavior, start, argument, level, keep, drops, required, represents, extend, nothing, below, calls, may, dropped, queuing, timer, advance, those, cases, reach, minutes, also, current, remains, valid, expires, assigns, clears, less, expiry, issues, persists, unique, assigned, assignment, recommend, rather, identify, users, exactly, characters, hexadecimal, invalid, input, leaves, unchanged, lowercase, uses, instance, nsstring, sharedmanager, let, shared, support, forwarded, was, used, source, leave, unset, optional, lets, associate, various, gets, keeps, replace, identifier, own, crm, mcp, skip, disable, delay, layer, security, policy, csp, popup, examples, profile, building, resolution, attributes, activation, progressive, applications, pwa, accelerated, mobile, amp, integrations, trackprofileattributes, trackinteraction, trackimpression, trackecommerce, setincludedefaultcustomvariables, setdryrun, isprefixingon, getuseremail, getsessiontimeout, getprofileattributes, getoptout, getincludedefaultcustomvariables, getdryrun, getdispatchinterval, sourcetrafficversion, sourcetrafficname, sessionhash, useragent, visitorid, sendtransaction, sendsocialinteraction, sendsearch, sendaudiencemanagerattribute, sendoutlink, sendgoal, sendevent, senddownload, sendcontentinteraction, sendcontentimpression, checkmembership, trackprofileattribute, trackecommercetransaction, trackcustomvariable, trackcustomdimension, trackappinstall, setincludedefaultvariables, readuserprofileattributes, getvisitoridlifetime, visitvariables, socialinteraction, search, screens, interaction, order, impression, goal, dimension, setusermail, settrafficsourceversion, settrafficsourcename, setofflinecachesize, setofflinecacheage, setincludedefaultcustomvars, setdryruntarget, setdispatchtimeout, setdispatchmode, setdeviceid, setapplicationdomain, items, getdeviceid, audiencemanagersetprofileattribute, android, tracksavechoicesclick, trackreminderwidgetview, trackrejectallclick, trackprivacypolicylinkview, trackmainformview, trackclosebuttonclick, trackagreetoallclick, setinitialcompliancesettings, setcompliancesettings, senddatarequest, openconsentform, getnewcompliancetypes, getcompliancetypes, getcompliancesettings, overview, setuserisanonymous, setsessionidstrictprivacymode, setiptracking, getvisitorinfo, resetuserid, deanonymizeuser, settrackerurl, settimingdatasamplingonpageload, setsiteinspectorsetup, setsiteid, setreferrerurl, setlinktrackingtimer, setdomains, setdocumenttitle, setcustomurl, setenableclienthints, setapiurl, gettrackerurl, gettimingdatasamplingonpageload, getdomains, getsiteid, getpiwikurl, getlinktrackingtimer, discardhashtag, getcurrenturl, addtracker, disableperformancetracking, configuration, trackerror, settrackingsourceprovider, settrackingsource, setrequestmethod, setrequestcontenttype, setgenerationtimems, setcustomrequestprocessing, setdonottrack, setcountprerendered, redirectfile, ping, killframe, gettrackingsource, gettrackingsourceprovider, getnumtrackedpageviews, enablejserrortracking, getconfigidpageview, appendtotrackingurl, addlistener, miscellaneous, trackheartbeat, enableheartbeattimer, disableheartbeattimer, heartbeat, setecommerceview, removeecommerceitem, getecommerceitems, clearecommercecart, addecommerceitem, ecommerce, removedownloadclasses, getdownloadextensions, getdownloadclasses, tracklink, adddownloadclasses, setlinkclasses, setignoreclasses, setdownloadextensions, setdownloadclasses, removedownloadextensions, getconfigdownloadextensions, enablelinktracking, disablelinktracking, adddownloadextensions, storecustomvariablesincookie, getcustomvariable, deletecustomvariable, setcustomdimensionvalue, getcustomdimensionvalue, deletecustomdimension, getcustomdimension, setcrossdomainlinkingtimeout, iscrossdomainlinkingenabled, getcrossdomainlinkingurlparameter, enablecrossdomainlinking, customcrossdomainlinkvisitoridgetter, disablecrossdomainlinking, customcrossdomainlinkdecorator, domain, linking, setvisitorcookietimeout, setvisitoridcookie, setsessioncookietimeout, setsecurecookie, setcookiepath, setreferralcookietimeout, setcookienameprefix, setcookiedomain, hascookies, getcookiepath, getsessioncookietimeout, getcookiedomain, getconfigvisitorcookietimeout, enablecookies, disablecookies, deletecookies, cookie, trackvisiblecontentimpressions, trackcontentinteractionnode, trackcontentimpressionswithinnode, trackallcontentimpressions, logallcontentblocksonpage, tracksitesearch, trackpageview, trackevent, basic, plain, javascript, vue, nuxt, gatsby, angular, frameworks, browser, jump, agents, developers, llms, txt, index, all, markdown, endpoints, openapi,
Text of the page (random words):
einspectorsetup settimingdatasamplingonpageload settrackerurl user management deanonymizeuser getuserid getvisitorid resetuserid getvisitorinfo setiptracking setsessionidstrictprivacymode setuserid setuserisanonymous consent manager js api overview custom consent form methods getcompliancesettings getcompliancetypes getnewcompliancetypes openconsentform senddatarequest setcompliancesettings setinitialcompliancesettings trackagreetoallclick trackclosebuttonclick trackmainformview trackprivacypolicylinkview trackrejectallclick trackreminderwidgetview tracksavechoicesclick android sdk methods audiencemanagergetprofileattributes audiencemanagersetprofileattribute checkaudiencemembership dispatch ecommerceaddtocart ecommercecartupdate ecommerceorder ecommerceproductdetailview ecommerceremovefromcart getsessionhash getdeviceid getuseragent isanonymizationon items additem setanonymizationstate setapplicationdomain setdispatchinterval setdeviceid setdispatchmode setdispatchtimeout setdryruntarget setincludedefaultcustomvars setofflinecacheage setofflinecachesize setprefixing setoptout setsessiontimeout setsessionhash settrafficsourcename settrafficsourceversion setusermail setuserid setvisitorid setvisitoridfromdeeplink setvisitoridlifetime track applicationinstall startnewsession track applicationupdate track campaign track dimension track download track event track exception track goal track impression track order track interaction track outlink track screen track screens track search track socialinteraction track sendapplicationdownload track variable track visitvariables getting started using piwik pro sdk cross platform tracking advanced usage flutter sdk methods checkaudiencemembership dispatch dryrun getsessionhash getuseragent getvisitoridlifetime readuserprofileattributes optout setanonymizationstate setdispatchinterval setincludedefaultvariables setsessionhash setuseremail setsessiontimeout setuserid setvisitorid setvisitoridfromdeeplink trackappinstall setvisitoridlifetime trackapplicationinstall trackapplicationupdate trackcampaign trackcontentimpression trackcontentinteraction trackcustomdimension trackcustomvariable trackcustomevent trackdownload trackecommerceaddtocart trackecommercecartupdate trackecommerceorder trackecommerceproductdetailview trackecommercetransaction trackecommerceremovefromcart trackexception trackgoal trackprofileattribute trackoutlink trackscreen tracksearch tracksocialinteraction getting started using the flutter sdk advanced usage cross platform tracking ios sdk getting started methods additem audiencemanagergetprofileattributes checkmembership deviceid dispatchinterval dryrun ecommerceaddtocart ecommercecartupdate ecommerceorder ecommerceproductdetailview ecommerceremovefromcart includedefaultcustomvariable isanonymizationenabled maxageofqueuedevents maxnumberofqueuedevents optout sendapplicationdownload sendcampaign sendcontentimpression sendcontentinteraction senddownload sendevent sendexception sendgoal sendoutlink sendaudiencemanagerattribute sendsearch sendsocialinteraction sendtransaction sendview sendviews sessiontimeout setcustomdimension setcustomvariable startnewsession useremail userid visitorid applicationinstall applicationupdate dispatch deletequeuedevents setvisitoridfrom useragent appname appversion samplerate eventsperrequest visitoridlifetime isprefixingenabled sessionhash sourcetrafficname sourcetrafficversion using piwik pro sdk cross platform tracking advanced usage react native sdk advanced usage getting started methods checkaudiencemembership dispatch getdispatchinterval getdryrun getincludedefaultcustomvariables getoptout getprofileattributes getsessionhash getsessiontimeout getuseragent getuseremail getuserid getvisitorid isanonymizationon isprefixingon setanonymizationstate setdispatchinterval setdryrun setincludedefaultcustomvariables setoptout setprefixing setsessionhash setsessiontimeout setuseremail setuserid setvisitorid setvisitoridfromdeeplink setvisitoridlifetime startnewsession trackapplicationinstall trackapplicationupdate trackcampaign trackcustomevent trackdownload trackecommerce trackecommerceaddtocart trackecommercecartupdate trackecommerceorder trackecommerceproductdetailview trackecommerceremovefromcart trackexception trackgoal trackimpression trackoutlink trackinteraction trackprofileattributes trackscreen tracksearch tracksocialinteraction using piwik pro sdk for react native cross platform tracking other integrations accelerated mobile pages amp integration progressive web applications integration pwa web log analytics data activation custom attributes identity resolution profile building data import other custom popup examples content security policy csp custom data layer name skip link tracking with the data disable delay attribute mcp server advanced usage user id the user id lets you associate events from various sources with the same user each new visitor gets a randomly generated visitor id that the sdk keeps between app launches with the user id you can replace this random identifier with your own for example an email address or an id from your crm use the userid property to set the user id swift objective c piwiktracker sharedinstance userid john doe piwiktracker sharedinstance userid john doe use a non empty string when you set a user id pass nil or leave unset so the sdk does not send one the property itself is optional on the tracker the user id is not sent if data anonymization is enabled isanonymizationenabled yes user email address ️ deprecated the user email address property useremail was used by audience manager audience manager is no longer available in the latest product version use the user id for cross source identity instead device id ️ deprecated the deviceid property is no longer recommended audience manager is no longer available in the latest product version and the value is only forwarded on audience manager requests by default the device id is empty nil you can set a non empty string with the property for example idfa from ad support swift objective c import adsupport let idfa asidentifiermanager shared advertisingidentifier uuidstring piwiktracker sharedinstance deviceid idfa import adsupport asidentifiermanager h nsstring idfa asidentifiermanager sharedmanager advertisingidentifier uuidstring piwiktracker sharedinstance deviceid idfa the device id is not sent if data anonymization is enabled visitor id to track user sessions across different sources the sdk uses the visitor id the visitor id is randomly generated when the tracker instance is created and is stored between application launches you can set the visitor id manually using setvisitorid newvisitorid swift objective c piwiktracker sharedinstance setvisitorid newvisitorid 0123456789abcdef piwiktracker sharedinstance setvisitorid 0123456789abcdef for setvisitorid the id must be exactly 16 characters lowercase hexadecimal 0 9a f only invalid input leaves the stored visitor id unchanged when anonymization is enabled the sdk issues a new visitor id when it first needs one in an app run and persists it every unique visitor must be assigned a different id and that id must not change after assignment we recommend using the user id rather than the visitor id to identify users you can also limit how long the current visitor id remains valid with visitoridlifetime seconds when it expires the sdk assigns a new random visitor id and clears visit scoped data for example default visit custom variables custom dimensions campaign parameters use 0 or less for no expiry default swift objective c piwiktracker sharedinstance visitoridlifetime 30 24 60 60 piwiktracker sharedinstance visitoridlifetime 30 24 60 60 sessions a session represents a set of user interactions with your app by default the sdk starts a new session when more than 30 minutes pass without any queued analytics event only interactions that reach the local queue extend the session with optout enabled nothing is queued and with samplerate below 100 some calls may be dropped before queuing so the timer does not advance in those cases you can change the timeout with sessiontimeout swift objective c piwiktracker sharedinstance sessiontimeout 30 60 piwiktracker sharedinstance sessiontimeout 30 60 the timeout required is a session timeout time in seconds you can manually start a new session with startnewsession the no argument call drops visit level data you set on the tracker for example visit custom variables to keep that data use startnewsession preservesessionparameters true swift objective c piwiktracker sharedinstance startnewsession piwiktracker sharedinstance startnewsession preservesessionparameters true piwiktracker sharedinstance startnewsession piwiktracker sharedinstance startnewsession yes dispatching tracked events are stored temporarily on the queue and by default dispatched in batches every 30 seconds you can change this behavior with dispatchinterval dispatchinterval 0 incoming events are dispatched immediately dispatchinterval 1 incoming events are not dispatched automatically you can then trigger a manual dispatch with dispatch swift objective c piwiktracker sharedinstance dispatchinterval 1 do try processcart catch piwiktracker sharedinstance sendexception description error localizeddescription piwiktracker sharedinstance dispatch piwiktracker sharedinstance dispatchinterval 1 try self processcart catch nsexception exception piwiktracker sharedinstance sendexceptionwithdescription exception reason piwiktracker sharedinstance dispatch when more than one event is queued the sdk sends them in bulk using post requests with a json payload one call to dispatch can still use several http requests when the backlog is larger than eventsperrequest allows for a single request to drop everything that is currently queued without sending it use deletequeuedevents default custom variables the sdk can automatically populate platform name os version and app version into visit scoped custom variables with indexes 1 3 by default this option is on toggle it with includedefaultcustomvariable swift objective c piwiktracker sharedinstance includedefaultcustomvariable false piwiktracker sharedinstance includedefaultcustomvariable no if you need to use indexes 1 3 yourself turn this option off and set custom variables manually with setcustomvariable legacy or use the recommended setcustomdimension app name and app version by default the sdk reads the app name from cfbundledisplayname or cfbundlename as a fallback and builds the version string from cfbundleshortversionstring and cfbundleversion formatted like the app version custom variable you can override either with appname and appversion swift objective c piwiktracker sharedinstance appname myapp beta piwiktracker sharedinstance appversion 2 5 0 beta build 123 piwiktracker sharedinstance appname myapp beta piwiktracker sharedinstance appversion 2 5 0 beta build 123 local storage limits you can set limits on how long and how many events are kept in local storage events older than the limit are discarded on the next dispatch attempt the piwik backend accepts back dated events for up to 24 hours by default to change the maximum age of queued events use maxageofqueuedevents swift objective c piwiktracker sharedinstance maxageofqueuedevents 12 60 60 piwiktracker sharedinstance maxageofqueuedevents 12 60 60 to change the maximum number of queued events use maxnumberofqueuedevents the default is 500 setting the limit to 0 stops new events from being queued swift objective c piwiktracker sharedinstance maxnumberofqueuedevents 250 piwiktracker sharedinstance maxnumberofqueuedevents 250 anonymization when anonymization is on the user s ip address location only the country is reported user id and device id are not collected the sdk generates a new visitor id each time the application starts when it first needs one in that run the default value is yes swift objective c piwiktracker sharedinstance isanonymizationenabled false piwiktracker sharedinstance isanonymizationenabled no opt out when optout is true the sdk does not store new analytics events the flag defaults to false and is persisted across app restarts and upgrades events already in the queue before opt out can still be uploaded if you call dispatch to drop them without sending use deletequeuedevents swift objective c piwiktracker sharedinstance optout true piwiktracker sharedinstance optout yes dry run dryrun is useful during development instead of sending events to the piwik server the sdk prints them to the console swift objective c piwiktracker sharedinstance dryrun true piwiktracker sharedinstance dryrun yes sample rate if your app generates a lot of analytics traffic you can configure client side sampling with samplerate the value is a whole number from 1 to 100 roughly samplerate 100 of analytics events are kept the fraction is approximate default 100 no sampling swift objective c piwiktracker sharedinstance samplerate 10 piwiktracker sharedinstance samplerate 10 url prefixing when isprefixingenabled is true default sendview and sendviews prepend the screen segment to the path you pass for example settings becomes screen settings other tracking apis are not governed by this flag turn prefixing off if you want only the path strings you supply swift objective c piwiktracker sharedinstance isprefixingenabled false piwiktracker sharedinstance isprefixingenabled no using the sdk with swiftui the sdk works with both uikit uiapplicationdelegate and swiftui app protocol lifecycles this section covers the patterns you need when using the swiftui lifecycle the default for new xcode projects since ios 14 initializing the tracker the simplest place to configure the tracker is the app initializer it runs once before any scene or view is created swift import swiftui import piwikprosdk main struct myapp app init piwiktracker sharedinstance siteid site id baseurl url string https example piwik pro var body some scene windowgroup contentview if you need standard uiapplicationdelegate callbacks attach a small appdelegate using uiapplicationdelegateadaptor see the landing page for the full example tracking screen views with onappear call sendview from the onappear modifier when the view appears in a uikit uiviewcontroller call it from viewdidappear instead swift struct contentview view var body some view vstack text hello world onappear piwiktracker sharedinstance sendview view home reusable view modifier if you track screen views from many views define a small modifier so each call site stays a single line swift extension view func trackpiwikview _ name string some view onappear piwiktracker sharedinstance sendview view name struct settingsview view var body some view form trackpiwikview settings handling deep links with onopenurl attach the onopenurl modifier to attribute incoming urls to web sessions or pass campaign data in a uikit app delegate handle the same urls in application _ open options sendcampaign does not sen...
|