How to collect the data you need to bootstrap your digital marketing analytics
Tags: dataengineering, data, marketing, analytics
Published: 2019-10-19 18:35:00

---
title: How to collect the data you need to bootstrap your digital marketing analytics
published: true
tags: data-engineering,data,marketing,analytics
canonical_url: https://medium.com/analytics-and-data/how-to-collect-the-data-you-need-to-bootstrap-your-digital-marketing-analytics-b401b01071d2
---

![](https://cdn-images-1.medium.com/max/1024/0*ZxBcyOPlfApyfJT6)<figcaption>Photo by <a href="https://unsplash.com/@campaign_creators?utm_source=medium&amp;utm_medium=referral">Campaign Creators</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption>

To a large extent boot-strapping your marketing activities with data, resolves around the collection of data of two or three specific domains depending on the scope of your business.

- **_Campaign Activity_** : Be it from Digital Marketing, pushing ads such as Facebook or Google ads, or more through email service providers/marketing automation.
- **_Clickstreams:_** Provides an understanding of the customer journey on site and the different factors that contributed to a conversion. Leveraging clickstream data allows to be able to properly attribute conversion to specific campaigns.
- **_Sales:_** Digital Marketing for e-commerce websites revolves around generating online sales. These should be tracked and the campaign spend should be optimized against this objective.

### Use Cases

There are quite a few use cases around marketing analytics, but we can easily show how these data sources of Campaign Activity, Clickstreams and Ecommerce sales can drive some of the biggest marketing analytics use cases such as media-mix modelling, marketing attribution and churn prevention.

#### Media-Mix Modeling

Media-mix modeling (MMM) allows to get an understanding of how to shift your budget mix among different advertising channels to optimize your outcome. It relies on statistics techniques to understand where 1 unit of marginal spend would be best placed.

MMM relies on two specific source of information 1. Spend data (Campaign) 2. an Outcome data (Eg: Ecommerce Sales), that we want to optimize for. In Order to be effective it is important for MMM to have a view of all the different channel spend contributing to the outcome.

#### Marketing Attribution

Marketing attribution role is to assign credit to specific marketing campaign, to get a better sense of their contribution to a specific objective. Attribution methods such as “last click”, provide full credit to a specific campaign when an objective is reached, in this case it provides the full credit of a campaign to the last touchpoint having contributed to the said objective, while other techniques can partial credit. Explanation of different attribution techniques are provided in the following medium posts: [here](https://medium.com/@odolenakostova/online-attribution-in-a-multi-channel-marketing-world-d2141f08f9d6) and [here](https://medium.com/analytics-for-humans/an-in-depth-look-at-attribution-modeling-in-digital-marketing-2ed0170c6f3b).

Marketing attribution relies on Campaign Data (Spend), Clickstream information and Sales data in order to properly attribute Campaign activities. Along with setting up the different systems to collect the information, proper url tagging (UTM) and potentially setting up the right Cookies on the websites are necessary first step to enable this use case.

#### Churn Prevention

Churn identification and prevention is one of the most traditional CRM use cases. It leverages upon Sales and Campaign data (CRM) to get a better understanding as to what customers are likely to churn and to what offer they would tend to respond to in order to stick with the service offering.

### Data Collection

In general one of the hardest part of empowering Marketing Analytics is the ability to source the data. It requires information to be pulled from a variety of sources. Depending on the specific of the Business trying to kick-start this use-case there can be a variety of applicable ways to integrate each of the data sources required.

### Campaigns data collection

There exists quite a few way to integrate and collect campaign data, from using specific data integration solutions, to leveraging singers taps, using the different tools built in data export capabilities or through building specific API pipelines.

**Data Integration solutions**

Different tools exists to simplify the collection of data from marketing campaigns, [Talend](http://talend.com), [Adverity](http://www.adverity.com), [Fivetran](http://fivetran.com) and [Alooma](https://www.alooma.com/integrations) (recently acquired by Google) provide a series of connectors that make data integration from these different ad-sources fairly easy.

#### Singer Taps

![](https://cdn-images-1.medium.com/max/1024/0*hqorE7mNxyPOJD0_)<figcaption>Photo by <a href="https://unsplash.com/@arstyy?utm_source=medium&amp;utm_medium=referral">Austin Neill</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption>

[Singer taps](https://www.singer.io/#taps) provides open-source pre-built connectors to a series of advertising sources such Facebook, Google, Outbrain, Salesforce, Marketo, Selligent,.. The data from these sources can be then be easily fetched by only modifying some configuration settings and executing a command line call, for instance

```
tap-adwords -c config.json -p properties.json -s state.json
```

#### **Data Exports**

![](https://cdn-images-1.medium.com/max/1024/0*5u5Yc2AVP6D_uBRS)<figcaption>Photo by <a href="https://unsplash.com/@chuttersnap?utm_source=medium&amp;utm_medium=referral">chuttersnap</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption>

Certain advertising tools allows for data exports to Big Query, a different data-warehouse tool or as file exports, for instance:

- [DoubleClick](https://cloud.google.com/bigquery/docs/doubleclick-campaign-transfer) and [Emarsys](https://help.emarsys.com/hc/en-us/articles/360000176214-Open-Data-End-user-guide) provide exports to Google BigQuery
- Salesforce Marketing Cloud allows [FTP/CSV exports](https://help.salesforce.com/articleView?id=mc_es_export_de.htm&type=5), flow which can be automated in automation studio and then ingested into a database/data-warehouse

#### **Custom Development — API Pipelines**

![](https://cdn-images-1.medium.com/max/1024/0*g1fMzVezKLP4SkTD)<figcaption>Photo by <a href="https://unsplash.com/@lastly?utm_source=medium&amp;utm_medium=referral">Tyler Lastovich</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption>

Development of pipelines to pull directly the data from Facebook, Google through API calls. This requires a data engineer or developer to setup the different data-flows. Most advertising sources provide SDK for easy integrations with their platforms.

- _Google Ads_: [Google API Python Client](http://google-api-python-client)
- _Facebook:_ [Facebook Business SDK](https://developers.facebook.com/docs/business-sdk/)
- _Salesforce Marketing Cloud:_ [FuelSDK](https://github.com/salesforce-marketingcloud/FuelSDK-Python)

### ClickStream Collection

Different alternatives exist in order to collect clickstream data, from relying on a premium analytics tool such as google analytics 360 or Adobe, leveraging a Customer Data Platform, a Clickstream collector or through setting up some custom development.

#### Google Analytics/Adobe Analytics

![](https://cdn-images-1.medium.com/max/1024/0*99-7FyjAUlsFYVMS)<figcaption>Photo by <a href="https://unsplash.com/@austindistel?utm_source=medium&amp;utm_medium=referral">Austin Distel</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption>

The simplest way, if you can afford it, to collect raw clickstream data is through google/adobe Analytics. Google offers the possibility to export raw clickstream data to Big Query as part of their Google 360 offering. One of the major draw-back of going for that route is the $150k annual cost of Google Analytics 360.

#### Customer Data Platform

![](https://cdn-images-1.medium.com/max/1024/0*mmO5q1LR9o1ctSxv)<figcaption>Photo by <a href="https://unsplash.com/@blakewisz?utm_source=medium&amp;utm_medium=referral">Blake Wisz</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption>

Most customer data platform offer the possibility to export ingested events to a data-warehouse. They ingest data from multiple sources, including website activity and are able to stream it back for processing or analysis. Depending on the size of your business, a customer data platform might prove more expensive than purchasing a Google 360 license, but offers additional benefits. Certain CDP such as [segment](https://segment.com/pricing/), offer a free version up to a certain amount of events or active users.

#### ClickStream Collector

Different open source clickstream collectors exist, the most known one are [Snowplow](https://snowplowanalytics.com/) and [divolte](https://divolte.io/). They offer a way to ingest clickstream data, without the need to fully develop it. The draw-back of using these, is that you need to be managing the infrastructure.

#### Custom development

Another solution to collect clickstream data is through custom development. Logic App, Function App, Lambda function and an EventHub/Kinesis/PubSub setup would allow for a scalable ingestion of data, but at the cost of managing code and infrastructure .

### (Online) Sales data collection

There are different ways to source information related to online sales, all of which have their own set of pros and cons:

- **_Analytics Tags:_** Analytics tags on the website to get a sense of online sales data. Data from your analytics tools can then be exported either manually, through API call or for those with Google 360 through a Big query export.
- **_Database replication/mirroring:_** Some e-commerce platforms expose or let you choose your own database solution. This allows for using database replication / mirroring to get a live copy of the data for analysis or reporting purpose.
- **_Data Integration Solutions:_** Pre-built data integration solutions exists, with certain platforms, acquiring one of these solution can significantly eases the development and maintenance needed to handle this part of the data collection process.
- **_Singer Taps:_** Certain platforms, have singer taps created for them, essentially a pre-built ETL/API client which only needs to be configured before pulling the data.
- **_API Pipelines:_** API pipelines can be generated on schedule to pull relevant information. They do require some custom development in order to pull.
- **_Webhooks:_** Webhooks provides for platform supporting it, of a way to export and ingest data in real-time. Their main draw back is that you need to develop and maintain infrastructure, API/Webhook receiver.
- **_Streams:_** Some e-commerce solutions allow you to get a feed of transaction to an event stream exports. This allows for getting real-time ingestion by passing an API/Webhook receiver.

#### Analytics Tags

![](https://cdn-images-1.medium.com/max/1024/0*IyvoarznC1u60EfA)<figcaption>Photo by <a href="https://unsplash.com/@nevenkrcmarek?utm_source=medium&amp;utm_medium=referral">Neven Krcmarek</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption>

It is possible to capture online sales data through an analytics tag such as Google’s. Google provides a structured way to pass the information to analytics through its [enhanced ecommerce](http://enhanced%20ecommerce) plug-in. This allows to provide a good first pass at capturing e-commerce data, there is however quite a few drawbacks from that approach:

1. _Ad-blocker_: This approach faces issues for user using certain ad-block, which blacklist Google Analytics domain and any attempt from the analytics.js tag, although there are [some workarounds](https://medium.freecodecamp.org/save-your-analytics-from-content-blockers-7ee08c6ec7ee)
2. _Page Load issues:_ Users, who leaves the thank you page before the tag has had the chance to fire, would not have their order data being pushed to Google Analytics
3. _Delayed Payment:_ Orders having payment methods that allow for delayed payment, such as Bank Transfer or Paypal, might be incorrectly classified as a successful sales or not recorded depending on the approach taken.

The main advantage from using this approach is the universality of it and the speed at which this can be deployed, usually only necessitating some tag integration for most web-shops, and for certain platform such as shopify, only some [simple configuration](https://help.shopify.com/en/manual/reports-and-analytics/google-analytics/google-analytics-setup).

Another of the advantage of setting up enhanced e-commerce tracking, is the ability to tie purchase to specific sessions and therefore be able to rely on google’s last click attribution. With it it is possible to attribute specific orders to specific campaign and sales-channel based on a last click attribution, this can be beneficial.

#### Database Replication & Mirroring

![](https://cdn-images-1.medium.com/max/1024/0*BTBtbVzE4j8sYmgi)<figcaption>Photo by <a href="https://unsplash.com/@fodelwdc?utm_source=medium&amp;utm_medium=referral">Fares Hamouche</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption>

Some E-commerce platforms, allow those operating the platform to setup their own database , this is the case of [Magento](https://devdocs.magento.com/guides/v2.3/install-gde/install/web/install-web_2-db.html), [EpiServer](https://world.episerver.com/documentation/Items/Developers-Guide/Episerver-CMS/8/Deployment/About-the-database/), or SiteCore for instance. In these cases, it is possible to setup a Master-Slave database replication or [database mirroring](https://docs.microsoft.com/en-us/sql/database-engine/database-mirroring/database-mirroring-sql-server?view=sql-server-2017), so that the data can be used for reporting purpose without affecting the production environment.

These can be setup without custom development, and can allow for a quick turnaround for providing data for reporting purposes.

#### Data Integration solutions

As for Campaign data, data integration tools exists that provide turnkey integration for e-commerce data. Each of the mentioned vendors provide connectors to certain e-commerce platforms:

- _Talend_: Shopify, BigCommerce and Magento are available as Talend connectors from [Cloudbee](https://cloudbee.com/talend-open-studio-components/),
- _Advertity_: supports Hybris, Shopware, Shopify and Magento
- _FiveTran_: supports Salesforce CommerceCloud, Magento, WooCommerce, Shopify and SpreeCommerce
- _Alooma:_ supports Shopify and Magento

The use of these data integration solution are an alternative when there is lack of technical capabilities within the team/department.

#### Singer Taps

![](https://cdn-images-1.medium.com/max/1024/0*cG-p110dxzgQZ9Pm)<figcaption>Photo by <a href="https://unsplash.com/@dchuck?utm_source=medium&amp;utm_medium=referral">Daniel Chekalov</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption>

Currently [WooCommerce](https://github.com/singer-io/tap-woocommerce) is the only web-shop, having a [singer-tap](https://www.singer.io/#taps) connector, making it’s use quite restricted. It is however possible to develop custom singer taps for specific use. This can be a good move, when already operating online campaign data collection through SingerTaps.

#### Custom Development — API Pipelines

![](https://cdn-images-1.medium.com/max/1024/0*f7r7p7QkXdJYe94r)<figcaption>Photo by <a href="https://unsplash.com/@quinten149?utm_source=medium&amp;utm_medium=referral">Quinten de Graaf</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption>

Most web-shops these days allows for pulling order information directly as API calls, this is the case of Pure SaaS platforms such as [Shopify](https://help.shopify.com/en/api/reference/orders), [Lightspeed](https://developers.lightspeedhq.com/ecom/endpoints/order/), Commercecloud or [Commercetools](https://docs.commercetools.com/http-api-projects-orders), but also of the likes of [Magento](https://devdocs.magento.com/guides/m1x/api/rest/Resources/Orders/sales_orders.html#RESTAPI-Resource-SalesOrders-HTTPMethod-GET-orders).

Some of which are supported by python SDK:

- [Shopify Python SDK](https://github.com/Shopify/shopify_python_api)
- Commercetools with a [Python SDK](https://github.com/labd/commercetools-python-sdk)
- [Magento Python SDK](https://pypi.org/project/magento/2.1/)

One of the major drawback of this approach is that it requires custom data engineer or software engineer work, it requires polling and to a certain degree is not “real-time”. Certain platform furthermore have rate limitations that might make it impractical to work with for pulling large amounts of orders.

One of the advantage of it however, is the ability to pull updated information about specific orders to date-ranges.

#### Custom Development — Webhooks

![](https://cdn-images-1.medium.com/max/1024/0*8CLTHM1lmpfuf-Xp)<figcaption>Photo by <a href="https://unsplash.com/@chris_j_scott?utm_source=medium&amp;utm_medium=referral">Chris Scott</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption>

Webhooks are essentially a way to send a notification over HTTP when some type of event happen, for our purpose, they provides a way to create a real-time ingestion of data from an e-commerce platform. Web-hooks can also provide a way to go around some of the rate-limitation if there isn’t any need to make callbacks.

They do require some sort of web-hook listener API and ingestion layer in order to capture the data. These can be built with the same type of technologies used for capturing clickstream data, for example a Logic App / EventHub combination.

Most e-commerce platform supports web-hooks, [Shopfiy](https://help.shopify.com/en/api/reference/events/webhook), [Lightspeed](https://developers.lightspeedhq.com/ecom/tutorials/webhooks/) and [WooCommerce](https://docs.woocommerce.com/document/webhooks/), [Shopware](https://docs.enterprise.shopware.com/connect/rest_api/), and [Big commerce](https://developer.bigcommerce.com/api-docs/getting-started/webhooks/about-webhooks)support it natively, while Magento supports it through 3rd party plugins, and platforms, such as [sitecore](https://community.sitecore.net/developers/f/8/t/4489) or [episerver](https://www.c2experience.com/blog/getting-hooked-on-episerver-webhooks)need custom development.

#### Custom Development — Streams

![](https://cdn-images-1.medium.com/max/1024/0*4jgcEDgC6IZ1hzig)<figcaption>Photo by <a href="https://unsplash.com/@yan_slg?utm_source=medium&amp;utm_medium=referral">Boudhayan Bardhan</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption>

Some e-commerce platforms are able to publish events directly onto a message queue (eg: Google Pub/Sub, Azure Service Bus, AWS SQS). This is the case of [Commercetools](https://docs.commercetools.com/http-api-projects-subscriptions), that prefered this approach to the standard HTTP [webhooks](https://techblog.commercetools.com/webhooks-the-devil-in-the-details-ca7f7982c24f). This allows for instance to natively “duplicate” the relevant data for both processing (eg order fulfillment), and for long term storage in a datawarehouses and let the different consumer of the data “subscribe” from that single source of information.

Beside Google Pub/Sub that has a turnkey [export to a Datawarehouse (BigQuery)](https://cloud.google.com/dataflow/docs/guides/templates/provided-streaming#cloudpubsubsubscriptiontobigquery), the other technology choices will still require development work in order to ingest he data.

More from me on [Hacking Analytics](https://medium.com/analytics-and-data):

- [One the evolution of Data Engineering](https://medium.com/analytics-and-data/on-the-evolution-of-data-engineering-c5e56d273e37)
- [Leveraging Facebook Python API for Marketing Analytics](https://medium.com/analytics-and-data/leveraging-facebook-python-api-for-marketing-analytics-f4372f042112?source=friends_link&sk=43a90fda6d1bcdfa03379162ea00e46b)
- [5 domains of ecommerce Data Strategy](https://medium.com/analytics-and-data/5-domains-of-ecommerce-data-strategy-82b61356042c?source=friends_link&sk=2a29ed95b7882db2ff9d7adc3803554c)
- [10 Benefits to using Airflow](https://medium.com/analytics-and-data/10-benefits-to-using-airflow-33d312537bae?source=friends_link&sk=9449eedcb64c30fb1823c72901041f44)

* * *