Setting up link to API from PHP page to credit a conversion to a landing page and variant

  • 17 December 2014
  • 2 replies
  • 32 views

I have API access. I have created the API key. I know how to retrieve the page id, page variant, and visitor ID. I know that I need to trigger a new Lead creation in Unbounce via the API with conversion = true. But I am finding the API instructions at https://api.unbounce.com/doc/leads?co… not detailed enough.

How do I tell my php to open a connection to my API?
Do I need to include my new API key? If so, where do I put it (code example please).
How do I send a new lead creation request with conversion = true and the relevant page ID, variant, and visitor ID (code example please) .

Many thanks,
Axel


2 replies

Userlevel 2

Hi Axel,

We can’t offer support on PHP, but I’m hoping the community will step in to help with that part of your question.

I do know that you typically make requests in PHP through the cURL library, though: http://php.net/manual/en/book.curl.php Hope that gets you started.

In terms of including your API key, yes, you’ll need to include it with each request. To do this, you’ll need to use HTTP Basic Auth with the API key as the username and the password blank.

Additionally, have you considered external conversion tracking? http://support.unbounce.com/entries/3…

It allows you to add conversions from outside Unbounce just by pasting a JavaScript snippet into a webpage Ð so it’s a lot simpler than what you’re trying to achieve.

Hope that helps!

@Mark_Wainwright, does the external conversion tracking snippet attribute the conversion to a specific LP variant via the Unbounce visitor cookie? Want to make sure variant testing stays intact with external conversion tracking.

Thanks!

Jason

Reply