Data Warehouse

Tutorial Videos

API

Storage and Compute

Data Sources

CDC Setup

Transform

KPI

Models
Segments

Dashboard

Drill Down

Explores

Machine Learning

Sharing

Scheduling

Notifications

View Activity

Admin

Launch On Cloud

FAQs

FAQ's

Security

Feedback

Option to take feedback from UI

Release Notes

Release Notes

Google Ads V2

Models

Segments

The AdWords API is no longer available for new users. Hence, new users need to sign up for the Google Ads API.Sprinkle now supports this new API Google Ads V2 as a data source. Incremental ingestion is now supported for Google Ads Reports, which was not the case for the earlier version. 

In order to add Google Ads V2 as a Data Source, the user can click on Data Sources and then on the ‘+’ sign. Upon clicking on the ‘+’ sign a list of data sources appears. The user needs to select Google Ads V2 in this case and name the data source.


After naming the data source, user can choose either existing connection from the dropdown or can create a new connection.

Once the datasource is selected and named, the user will need to enter the Developer Token and also the Client Id. The Developer Token can be used to target any Google Ads account and download reports by using OAuth2 authentication. While giving the Client Id make sure to remove hyphen(-) present in the Client Id.

For ex:- If Client Id generated for Google Ads is 123-456-7890 then provide Client Id as 1234567890 in the Client ID field in the Connection page.

For details on how to generate Developer Token and get the client Id, click here.

Client Customer Id is referred to the account the user is targeting and this could be found at the top right corner near to Account Id. If there are any hyphens in the client ID, they should be removed. Once the Developer Token and Client Id details are filled, the user needs to Re-authorize Google.

After the connection is established, users can go to Datasets and select the table type as per their choice. Sprinkle offers two kinds of tables. They are Reports and Query.


If the user selects a Query then it is required to provide the table name and write the GAQL in the box provided. This will enable the user to deep dive into the Google Ads campaign that they might be running.


If the user selects reports, then need to provide the table name and select the report in the Report type field from the drop down.


Then select the required metrics and segment fields from the respective drop downs.


Then the user needs to select the ingestion mode - Complete or Incremental.

Complete ingestion loads the entire data at once irrespective of the pre-existing data.

And they can filter the data here using the where clause. 


In Incremental loading only new and latest data is ingested to the data source. For the first run, it ingests the complete data and then for subsequent runs it loads only new or updated data. Users need to specify the start date and window of days for this mode.


Advance Settings -

The user can select Yes in the Advance Settings field to change a few custom settings while connecting to the source. The settings include okhttp.read.timeout, okhttp.connection.timeout, okhttp.retry.limit, okhttp.retry.sleep.time, incremental.batch.size, and version. Default settings will be present for their respective fields, which the user can change as per their requirements.


import requests
from requests.auth import HTTPBasicAuth

auth =  HTTPBasicAuth(<API_KEY>, <API_SECRET>)
response = requests.get("https://<hostname>/api/v0.4/explore/streamresult/<EXPLORE_ID>", auth)

print(response.content)

library('httr')

username = '<API KEY>'
password = '<API SECRET>'

temp = GET("https://<hostname>/api/v0.4/explore/streamresult/<EXPLORE ID>",
           authenticate(username,password, type = "basic"))

temp = content(temp, 'text')
temp = textConnection(temp)
temp = read.csv(temp)

/*Download the Data*/

filename resp temp;
proc http
url="https://<hostname>/api/v0.4/explore/streamresult/<EXPLORE ID>"
   method= "GET"  
   WEBUSERNAME = "<API KEY>"
   WEBPASSWORD = "<API SECRET>"
   out=resp;
run;

/*Import the data in to csv dataset*/
proc import
   file=resp
   out=csvresp
   dbms=csv;
run;

/*Print the data */
PROC PRINT DATA=csvresp;
RUN;

import requests
import json

url='http://hostname/api/v0.4/createCSV'

username='API_KEY'
password='API_SECRET'

files={'file':open('FILE_PATH.csv','rb')}
values={'projectname':PROJECT_NAME','name':'CSV_DATASOURCE_NAME'}

r=requests.post(url, files=files, data=values, auth=(username,password))

res_json=json.loads(r.text)

print(res_json['success'])

import requests
import json

url='http://hostname/api/v0.4/updateCSV'

username='API_KEY'
password='API_SECRET'

files={'file':open('FILE_PATH.csv','rb')}
values={'projectname':PROJECT_NAME','name':'CSV_DATASOURCE_NAME'}

r=requests.post(url, files=files, data=values, auth=(username,password))

res_json=json.loads(r.text)

print(res_json['success'])

import requests

url='https://<hostname>/api/v0.4/explore/streamresult/<EXPLORE ID>'

username='API_KEY'
password='API_SECRET'

r=requests.get(url,auth=(username,password))
print(r)
print(r.text)

import requests
import pandas as pd

url='https://<hostname>/api/v0.4/explores/infoByFolder/<SPACE_ID>'

username='API_KEY'
password='API_SECRET'

r=requests.get(url,auth=(username,password)).json()
df = pd.DataFrame(r)
print(df)

import requests
import pandas as pd

url='https://<hostname>/api/v0.4/folders/byOrgName/<ORG_NAME>'

username='API_KEY'
password='API_SECRET'

r=requests.get(url,auth=(username,password)).json()
df = pd.DataFrame(r)
print(df.loc[:,['name','id']])

import requests

import pandas as pd

import io

url='https://<hostname>/api/v0.4/explore/streamresult/<EXPLORE ID>'

secret='API_SECRET'

r=requests.get(url,headers = {'Authorization': 'SprinkleUserKeys ' +secret } )

df = pd.read_csv(io.StringIO(r.text),sep=',')

import requests

import pandas as pd

import io

url='https://<hostname>/api/v0.4/segment/streamresult/<SEGMENT ID>'

secret='API_SECRET'

r=requests.get(url,headers = {'Authorization': 'SprinkleUserKeys ' +secret } )

df = pd.read_csv(io.StringIO(r.text),sep=',')

import requests

import json

url='http://hostname/api/v.o4/createCSV'

files={'file':open('path/file.csv’')}

values={'projectname':PROJECT_NAME,'name':'csv_datasource_name/table_name'}

secret='API_SECRET'

r=requests.post(url, files=files, data=values, headers = {'Authorization': 'SprinkleUserKeys ' +secret } )

res_json=json.loads(r.text)

import requests

import json

url='http://hostname/api/v.o4/updateCSV'

files={'file':open('path/file.csv’')}

values={'projectname':PROJECT_NAME,'name':'csv_datasource_name/table_name'}

secret='API_SECRET'

r=requests.post(url, files=files, data=values,headers = {'Authorization': 'SprinkleUserKeys ' +secret } )

res_json=json.loads(r.text)