# Sessions randomly restarting with a different source/medium

**URL:** <https://community.piwik.pro/t/sessions-randomly-restarting-with-a-different-source-medium/4172>\
**Category:** Data collection and tags\
**Created:** [July 4, 2024, 2:33pm UTC](https://community.piwik.pro/t/sessions-randomly-restarting-with-a-different-source-medium/4172 "2024-07-04T14:33:23Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bethlen.david.sofa](https://avatars.discourse-cdn.com/v4/letter/b/e9c0ed/32.png) [@bethlen.david.sofa](https://community.piwik.pro/u/bethlen.david.sofa)\
**Post date:** [July 4, 2024, 2:33pm UTC](https://community.piwik.pro/t/sessions-randomly-restarting-with-a-different-source-medium/4172/1 "2024-07-04T14:33:23Z")

</div>

Hello there,

I have integrated Piwik through GTM and everything, including the GA4 based gtag events are working fine. However, there are tons of sessions which inexplicably break and continue in an instant, assigning the wrong source/medium to the order. Let me show you an exact example.

User lands on the website coming from Facebook and starts looking at an item.

 ![image](https://europe1.discourse-cdn.com/flex005/uploads/piwikpro/original/2X/1/1f6b6a7c0752e6aec2a726a3f285ae759e5f4b17.png)

After browsing some more, he/she arrives to the cart page. Make note of the time stamps.

 ![image](https://europe1.discourse-cdn.com/flex005/uploads/piwikpro/original/2X/0/0302c10bec8843546993e0c00c6b240628b405cc.png)

For some reason, the session breaks on the login url, and it ends in an abandoned cart event. However, immediately after a new session starts on the same page, but now with a direct entry point. This is where the purchase is completed, completely robbing Facebook from the correct attribution:

![image](https://europe1.discourse-cdn.com/flex005/uploads/piwikpro/original/2X/d/d51de14ce0de18146a3bd3c677fcaaeef112dda6.png)

This is just one case, there are tons more. The “Start a new session when the referrer changes” option is turned OFF, the “Start a new session when the campaign changes” option was turned ON when this session was recorded. I turned it off now for testing, but it should not have affected the session, since there are no parameters added to the url on the cart page.

What could cause this strange phenomenon? Compared to GA4, the overall revenue is almost an exact match, but the attribution is leaning heavily towards direct in Piwik. If you need further information, I would be happy to provide it.

---

<div class="post-metadata">

**Author:** ![asinior](https://dub1.discourse-cdn.com/flex005/user_avatar/community.piwik.pro/asinior/32/1905_2.png) [@asinior](https://community.piwik.pro/u/asinior)\
**Post date:** [July 5, 2024, 11:53am UTC](https://community.piwik.pro/t/sessions-randomly-restarting-with-a-different-source-medium/4172/2 "2024-07-05T11:53:24Z")

</div>

Hi @bethlen.david.sofa,  
Welcome to the community!

Could you provide me with a URL of the site on which you are experiencing these issues? You can leave the URL here or send it to me via dm.

---

<div class="post-metadata">

**Author:** ![bethlen.david.sofa](https://avatars.discourse-cdn.com/v4/letter/b/e9c0ed/32.png) [@bethlen.david.sofa](https://community.piwik.pro/u/bethlen.david.sofa)\
**Post date:** [July 8, 2024, 12:59pm UTC](https://community.piwik.pro/t/sessions-randomly-restarting-with-a-different-source-medium/4172/3 "2024-07-08T12:59:16Z")

</div>

UPDATE: After discussing the topic with Adam in a private message, we came to the conclusion that the **Start a new session when the campaign changes** option was the culprit, because the user probably started browsing the website by using Facebook’s built-in browser, and switched to Chrome on the cart page, thus starting a new session because of the missing UTM parameters. Thank you Adam for the insight!

---

<div class="post-metadata">

**Author:** ![system](https://europe1.discourse-cdn.com/flex005/uploads/piwikpro/original/1X/db7013c4fd6a24443b339309db52f14995207737.png) [@system](https://community.piwik.pro/u/system)\
**Post date:** [July 10, 2024, 12:59pm UTC](https://community.piwik.pro/t/sessions-randomly-restarting-with-a-different-source-medium/4172/4 "2024-07-10T12:59:51Z")

</div>

Closed on July 10, 2024, 12:59pm UTC

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.
