Sending Data Via APIs Questions

  1. My system generates a unique cookie ID that is more than 16 character long, is there a way to use it or do I need to generate 16 character ID only?
  2. How does the Piwik know if I want to log a page view or an event. I did not see any option to specify that in the API? Is the presence of e_t used to determine if it is a page view or an event?
    I will have more questions as I complete the setup.

I am using Twillio Segment to send the data to Piwik PRO

Hi Anil,

  1. Only 16 character ID will work.

  2. Here’s the explanation What are events and how are they detected? | Piwik PRO help center, basic premise is: if a particular parameter value is present we will recognize the type of event it is based on the value. So for example if request contains paremeters with custom event category and action values it will be counted as a custom event.

Best,
Oliwer

1 Like

Hi,

when sending data using the Tracking HTTP API and there is only an ID available that does not fit the format, you can send it as uid instead of cid. It is somewhat ugly but it works… at least for the session. A cid will be created for this visitor… but there is one big caveat: you will never be able to recognize a returning visitor, so 100% of your visits will be new.

This is me, visiting my own website:

The only ID that I can provide is a User-ID. Visitor ID (“Besucher ID” in the screenshot) and Cookie ID are generated on the receiver side, I do not send them at all.

It might not be what you expected but it is at least something. As an alternative, you can hash your ID to generate a 16 character string using cyrb53 (I found it very suitable for measurement purposes): code/jshash/experimental/cyrb53.js at master · bryc/code · GitHub

hope that helps,

best
Markus

1 Like

@Oliwer_Kaczmarek How difficult is it to change Piwik PRO requirement to 32 characters or more? A lot of systems are creating longer cookie ids.

@Optizent you can use a hashing function and truncate the client id to 16 chars. We do it like that in the GTM server side template that translates GA4 events to Piwik PRO events.

sha256Sync(clientId, {outputEncoding: 'hex'}).substring(0,16)