How to get campaign name on checkout page on e-commerce store

Greetings! I want to get campaign name on checkout page. The campaign name is not present in page URL on that page. I tried to get it from {{FirstVisitCampaignName}} or {{LastVisitCampaignName}} using Matomo tag manager but it did not work for me.

In fact, I want to add campaign name and OrderId in a custom dimension but I am unable to get campaign name. Please help me out.

{{FirstVisitCampaignName}} was mentioned on getAttributionCampaignName() return no results on CrossLinkedDomain

I also have seen _rcn mentioned on https://developer.matomo.org/api-reference/tracking-api but I don’t know how to use it.

Anyone please help me to fix the above issue. I am waiting for your reply.