Pull from Google Analytics¶
Google Analytics is a web analytics service offered by Google that tracks and reports website traffic, including from iOS and Android apps. Marketers use these analytics to understand how people interact with websites and mobile applications.
Google Analytics ties online ordering data to transactional data that is useful for segmentation, order acquisition analysis, and future modeling opportunities. This source uses the v4 batchGet endpoint .
Tip
Use this data source to build acquisition channel reports.
Caution
Google Analytics should be run in 6-month batches to avoid load limit thresholds
This topic describes the steps that are required to pull online orders data that is tied to transactional data to Amperity from Google Analytics:
Get details¶
An account with permission to log in to Google Analytics as a standard administrator.
Your Google Analytics Account ID.
Your Google Analytics Web Property.
Your Google Analytics Profile ID.
Configure OAuth¶
OAuth is an open standard for access delegation, commonly used to grant websites or applications access to information on other websites.
To configure OAuth
From the Sources tab, click Add Courier. The Add Source page opens.
Find, and then click the icon for Google Analytics. The Add Courier page opens.
From the Credential drop-down, select Create a new credential. This opens the Create New Credential page.
Generate an authorization link, and then visit the URL that was generated to complete the authorization process.
When complete, you will be redirected to the Credentials page in Amperity.
Verify the credential is on the page, and then return to the Sources tab.
Remove access¶
Access to Google Analytics is managed directly from your Google Analytics account. You may remove access for the Amperity AdWords and Analytics App at any time:
Add courier¶
A courier brings data from external system to Amperity. A courier relies on a feed to know which fileset to bring to Amperity for processing.
To add a courier
From the Sources tab, click Add Courier. The Add Source page opens.
Find, and then click the icon for Google Analytics. The Add Courier page opens.
This automatically selects google-analytics as the Credential Type.
Select the user account you added when configuring OAuth.
Under Settings select a value from the following lists:
Your Google Analytics Account ID.
Your Google Analytics Web Property.
Your Google Analytics Profile ID.
Under Select Reports to Ingest select Transactional Analytics.
Click Create.
Run courier manually¶
Run the courier again. This time, because the load operations are present and the feeds are configured, the courier will pull data from Google Analytics.
Important
Configure the Google Analytics courier to pull data in six month batches to help ensure that load limits defined by the Google Analytics API are not exceeded.
To run the courier manually
From the Sources tab, open the menu for the courier with updated load operations that is configured for Google Analytics, and then select Run. The Run Courier dialog box opens.
Select the load option, either for a specific time period or all available data. Actual data will be loaded to a domain table because the feed is configured.
Click Run.
This time the notification will return a message similar to:
Completed in 5 minutes 12 seconds
Review feed and domain table¶
After running the Google Analytics courier it will create a source named Google Analytics and a feed named TransactionalAnalytics.
Important
The TransactionalAnalytics feed for Google Analytics cannot be edited and should not be made available to Stitch.
The data is loaded to Amperity and added to a domain table named Google Analytics:TransactionalAnalytics and contains the following fields:
ga:itemRevenue
ga:transactionId (assigned the pk semantic tag)
ga:browser
ga:campaign
ga:source
ga:mobileDeviceMarketingName
ga:keyword
ga:adGroup
ga:deviceCategory
ga:operatingSystem
ga:adMatchedQuery
ga:operatingSystemVersion
ga:medium
ga:isMobile
ga:daysToTransaction
Note
The number of records ingested and the number of records added to the domain table might be different. This is typically due to duplicate records in the data that was pulled from Google Analytics.
Add to courier group¶
A courier group is a list of one (or more) couriers that are run as a group, either ad hoc or as part of an automated schedule. A courier group can be configured to act as a constraint on downstream workflows.
To add the courier to a courier group
From the Sources tab, click Add Courier Group. This opens the Create Courier Group dialog box.
Enter the name of the courier. For example: “Google Analytics”.
Add a cron string to the Schedule field to define a schedule for the orchestration group.
A schedule defines the frequency at which a courier group runs. All couriers in the same courier group run as a unit and all tasks must complete before a downstream process can be started. The schedule is defined using cron.
Cron syntax specifies the fixed time, date, or interval at which cron will run. Each line represents a job, and is defined like this:
┌───────── minute (0 - 59) │ ┌─────────── hour (0 - 23) │ │ ┌───────────── day of the month (1 - 31) │ │ │ ┌────────────── month (1 - 12) │ │ │ │ ┌─────────────── day of the week (0 - 6) (Sunday to Saturday) │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ * * * * * command to execute
For example,
30 8 * * *
represents “run at 8:30 AM every day” and30 8 * * 0
represents “run at 8:30 AM every Sunday”. Amperity validates your cron syntax and shows you the results. You may also use crontab guru to validate cron syntax.Set Status to Enabled.
Specify a time zone.
A courier group schedule is associated with a time zone. The time zone determines the point at which a courier group’s scheduled start time begins. A time zone should be aligned with the time zone of system from which the data is being pulled.
Note
The time zone that is chosen for an courier group schedule should consider every downstream business processes that requires the data and also the time zone(s) in which the consumers of that data will operate.
Set SLA? to False. (You can change this later after you have verified the end-to-end workflows.)
Add at least one courier to the courier group. Select the name of the courier from the Courier drop-down. Click + Add Courier to add more couriers.
Click Add a courier group constraint, and then select a courier group from the drop-down list.
A wait time is a constraint placed on a courier group that defines an extended time window for data to be made available at the source location.
A courier group typically runs on an automated schedule that expects customer data to be available at the source location within a defined time window. However, in some cases, the customer data may be delayed and isn’t made available within that time window.
For each courier group constraint, apply any offsets.
An offset is a constraint placed on a courier group that defines a range of time that is older than the scheduled time, within which a courier group will accept customer data as valid for the current job. Offset times are in UTC.
A courier group offset is typically set to be 24 hours. For example, it’s possible for customer data to be generated with a correct file name and datestamp appended to it, but for that datestamp to represent the previous day because of the customer’s own workflow. An offset ensures that the data at the source location is recognized by the courier as the correct data source.
Warning
An offset affects couriers in a courier group whether or not they run on a schedule.
Click Save.