I’m trying to use the ubpv cookie to register a lead using php. The cookie shows up on the unbounce landing page, but disappears when I browse to my regular site, though the ubvt cookie stays. The permissions are all correct and I should be able to access it from the main domain as the path for the cookie is /. Does anyone know why this happens? I’m trying to keep track of my variants, but I only have one champion variant active. I can’t find any documentation about the technical details of this cookie.
Hi @er0sion, I’m a software developer here at Unbounce.
I think you might be running into a subdomain issue here. The ubpv
cookie will be scoped to the subdomain that your landing page is on. So if your landing page is on try.yoursite.com
, it will not be accessible to yoursite.com
, www.yoursite.com
etc.
Could you give us a bit more information about what you’re trying to achieve here? Hopefully someone in the community can suggest an alternative approach that doesn’t depend on this cookie.
Mark, you are correct. It is a sub domain issue. The problem is, using the api will require developers to hard code values because the ubpv key contains the page Id and variant, but it is locked down to the unbounce subdomain of a site.
Is there a way to use the ubvt cookie to get the page Id and variant that the user visited previously?
@er0sion Based on what you’ve said, I don’t think the ubtv
cookie will be useful to you here. It’s used to facilitate external conversion tracking (which is why it’s scoped to your root domain, not your Unbounce subdomain) and it doesn’t contain the page ID or variant.
One suggestion would be to use JavaScript on your landing pages to set a custom cookie, scoped to your root domain, containing the data you need to submit the lead. The page and variant IDs are available through the window.ub.page
JS object.
Thanks mark,
That was kind of my point with Unbounce’s support team discussion. The current solution inhibits developers creating wrappers, etc, in other languages easily when everything can be solved if unbounce changed the domain of the cookie or added the page Id and variant to the ubvt cookie.
I know that there is that external script to track conversions, but I should have an option to create conversions once instead of loading an external on every page load. What’s the point of the API if we can’t dynamically get the items to work with it?