# Piwik attribution: event sent from BQ database always Direct/Direct

**URL:** <https://community.piwik.pro/t/piwik-attribution-event-sent-from-bq-database-always-direct-direct/3715>\
**Category:** Reports and working with data\
**Created:** [February 28, 2024, 10:49am UTC](https://community.piwik.pro/t/piwik-attribution-event-sent-from-bq-database-always-direct-direct/3715 "2024-02-28T10:49:32Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![YvesBeebole](https://dub1.discourse-cdn.com/flex005/user_avatar/community.piwik.pro/yvesbeebole/32/1022_2.png) [@YvesBeebole](https://community.piwik.pro/u/YvesBeebole)\
**Post date:** [February 28, 2024, 2:40pm UTC](https://community.piwik.pro/t/piwik-attribution-event-sent-from-bq-database-always-direct-direct/3715/3 "2024-02-28T14:40:38Z")

</div>

Hi @Jarek ,

My name is Yves, and I am Elena’s colleague.

What you describe is exactly what we did. So here is a typical case and maybe you can highlight what might be wrong or if there is a limitation in how Piwik behaves.

Here is the full technical implementation.

We have a commercial domain: [https://beebole.com](https://beebole.com) and an app domain [https://beebole-apps.com](https://beebole-apps.com)

The Piwik JS is installed on the commercial domain and on the Signup/Signin pages of the app domain.

All events on the commercial website are tracked using the Piwik JS, then when someone decides to sign up for a trial, the Visitor ID is retrieved using this method:

> **[API](https://developers.piwik.pro/en/latest/data_collection/web/javascript_tracking_client/api.html?highlight=Getvisitorid#getVisitorId)**
>
> The following API allows the user to: track page views, track visits on multiple domains and subdomains, track e-commerce events (successful orders, cart changes, product and category views), track...

And then sent with a URL decoration:

> **[API](https://developers.piwik.pro/en/latest/data_collection/web/javascript_tracking_client/api.html?highlight=Getvisitorid#getCrossDomainLinkingUrlParameter)**
>
> The following API allows the user to: track page views, track visits on multiple domains and subdomains, track e-commerce events (successful orders, cart changes, product and category views), track...

To make sure the visitor ID is correctly passed through the two domains.

On the Signup page, once the signup form is completed, the Visitor ID is retrieved from the Piwik cookie and sent to our back end to identify the Visitor ID with the newly created User ID.

We store then the signup event with both IDs and that event is then sent as a backend event to Piwik via the API.

It usually works well, with the limitation of 3rd party cookies, …

Here is an example:

 ![Screenshot 2024-02-28 at 15.15.55](https://europe1.discourse-cdn.com/flex005/uploads/piwikpro/original/2X/3/3a36307b5add7d33253c86cd23db7e00596763cf.png)

The source and medium is there, the back-end event appears correctly, …

Now, the trial lasts for usually 30 days.

If an account becomes a customer, it triggers another event, with is then also stored in an event BQ table along with the User ID, but also with the first instance of the Visitor ID we have for that user. (Typically the visitor ID that was there when the person signed up.

Here is an example of that table where you can see the two events, with the same user ID and visitor ID:

 ![Screenshot 2024-02-28 at 15.18.52](https://europe1.discourse-cdn.com/flex005/uploads/piwikpro/original/2X/5/5ed6205e6db158681bc4a0ad05621f354bfd5fba.png)

The become\_customer event is then also sent via the API to Piwik.

But if I look for the example above, here is what I see for the signup and for the subscribed events:

 ![Screenshot 2024-02-28 at 15.20.13](https://europe1.discourse-cdn.com/flex005/uploads/piwikpro/original/2X/0/01dd59423a86a5c0927fdffd946338f725ea0731.png)

The Signup attribution report will correctly identify the source/medium.

 ![Screenshot 2024-02-28 at 15.20.46](https://europe1.discourse-cdn.com/flex005/uploads/piwikpro/original/2X/c/c1b9bcc74eff602a83f9cb57a230f009dc369554.png)

The subscribed will just show as direct/direct.

Despite the visitor ID being sent for the subscribed event and being the same as the signup event.

So, is there something to change?

Yves

---

_[View the full topic](https://community.piwik.pro/t/piwik-attribution-event-sent-from-bq-database-always-direct-direct/3715)._
