There is actually 2 ways you can do it:

  1. An easier and straightforward one
  2. Advanced using Google Analytics API and custom integration


1. Track leads with AC form and GTM code (20 min)


  1. AC form
  2. Landing page
  3. GTM

Update form with source value code

Steps to implement source tracking

  1. Create custom fields in AC for Source / Medium data
  2. Add form with hidden fields to website / landing page
  3. Setup GTM variables which extract ute tags from url parameter
  4. Create url with utm tags –
  5. Add GTM tag which update hidden fields with traffic source value

2. [Advanced] Track leads using Google Analytics API and Integromat

1. Pass Client ID to Activecampaign (12 min)

Get Client ID code

    var match = document.cookie.match('(?:^|;)\\s*_ga=([^;]*)');
    var raw = (match) ? decodeURIComponent(match[1]) : null;
if (raw)
match = raw.match(/(\d+\.\d+)$/);
var gacid = (match) ? match[1] : null;
if (gacid)
    return gacid;

Update form with client ID value 

  jQuery( '<input id="field[12]" type="hidden" name="field[12]" value="'+{{Client ID}}+'">' ).appendTo( jQuery( 'form' ) );

// replace field[12] with your custom field id

2. Test Google Analytics API (3 min)

API reference –

3. AC automation (8 min)

You can register Integromat here (if you haven’t yet)

4. Authorize Integromat to get info from Google API (17 min)

Test Google Analytics  API:

Interomat Google auth doc:

GA scope:

5. Completion of Integromat scenario (11 min)

"viewId": "yourid",
"user": {
"userId": "{{}}"
"activityTypes": [
"dateRange": {
"startDate": "{{formatDate(addDays(now; -30); "YYYY-MM-DD")}}",
"endDate": "{{formatDate(now; "YYYY-MM-DD")}}"
//replace "viewID" with your GA view ID
// I've used here date range for last 30 days, make sure to change it if you need another date range

6. Test whole integration and summary

…to be uploaded