Lunametrics are “a Google Analytics Certified Partner, a Google Analytics Premium Reseller, and Search Marketing guru” hailing from Pittsburgh. They run a blog that is one of the best resources for hands-on work with Google Analytics and Google Tag Manager.
As a final part to the series I will go through the script from the last part to give an idea what it does (which isn’t terribly much, since most of the work is done by the respective libraries).
In the last installment I promised to finally show some code, and I will – but there is one last hurdle to clear. Part 2 mentioned libraries, and how they extend the capabilities of a programming language.
Calling the Google- and Salesforce libraries requires a lot of code. But this is highly reusable code that does not change no matter which application uses it. Both companies provide libraries so you simply can call ready-made functions with your own credentials to get access.
With Salesforce you can create a web form to create up to 500 leads daily from data entered via your website; the information ist posted to Salesforce, and the user is directed back to a page in your website. To make this work you need to create some custom fields for the lead entity – one to store a key that can be used to join Google Analytics data together, the others as empty fields that will be filled in with the information pulled via the GA API.
Part 2 talked about APIs, the programming interfaces that make data exchange between disparate application possible. This tutorial will use two specific APIs, the Google Analytics Core Reporting API to pull records from Google Analytics, and the Salesforce REST Api.