예제 #1
0
import os, json
from datetime import datetime, timedelta
from analytics.connectors.mainReport import Report
from analytics.connectors import access_data

date_from = datetime.strftime(datetime.today() - timedelta(days=1), "%Y-%m-%d")
date_to = datetime.strftime(datetime.today() - timedelta(days=1), "%Y-%m-%d")

clients = json.load(
    open(
        os.path.join(
            os.path.split(os.getcwd())[0], "json_files", "clients.json"), "r"))
for client, placement in clients.items():
    fb_params = placement.get('facebook', None)
    if fb_params:
        project = placement['bigquery']['project']
        path_to_bq = os.path.join(
            access_data.path_to_json,
            access_data.name_json_files['project'][project]['path_to_bq'])

        for params in fb_params:
            report = Report(client, path_to_bq, date_from, date_to)
            report.get_facebook_report(access_data.facebook_token_general,
                                       params['account_id'])
예제 #2
0
import os, json, re
from datetime import datetime, timedelta
from analytics.connectors.mainReport import Report
from analytics.connectors import access_data

date_from = datetime.strftime(datetime.today() - timedelta(days=1), "%d/%m/%Y")
date_to = datetime.strftime(datetime.today() - timedelta(days=1), "%d/%m/%Y")

clients = json.load(
    open(
        os.path.join(
            os.path.split(os.getcwd())[0], "json_files", "clients.json"), "r"))
for client, placement in clients.items():
    calltouch_params = placement.get('calltouch', None)
    if calltouch_params:
        project = placement['bigquery']['project']
        path_to_bq = os.path.join(
            access_data.path_to_json,
            access_data.name_json_files['project'][project]['path_to_bq'])

        for params in calltouch_params:
            site_name_re = re.sub('[.-]', '_', params['name'])
            token = access_data.Calltouch[params['site_id']]
            report = Report(client, path_to_bq, date_from, date_to)
            report.get_calltouch_report(params['site_id'], token, site_name_re)
예제 #3
0
from datetime import datetime, timedelta
from analytics.connectors.mainReport import Report
from analytics.connectors import access_data

date_from = datetime.strftime(datetime.today() - timedelta(days=1), "%Y-%m-%d")
date_to = datetime.strftime(datetime.today() - timedelta(days=1), "%Y-%m-%d")

clients = json.load(
    open(
        os.path.join(
            os.path.split(os.getcwd())[0], "json_files", "clients.json"), "r"))
for client, placement in clients.items():
    analytics_params = placement.get('analytics', None)
    if analytics_params:
        project = placement['bigquery']['project']
        path_to_bq = os.path.join(
            access_data.path_to_json,
            access_data.name_json_files['project'][project]['path_to_bq'])

        path_to_ga = os.path.join(
            access_data.path_to_json,
            access_data.name_json_files['project'][project]['path_to_ga'])

        for params in analytics_params:

            report = Report(client, path_to_bq, date_from, date_to)
            report.get_analytics_report(params['view_id'], path_to_ga, [
                "General", "Goal1to4", "Goal5to8", "Goal9to12", "Goal13to16",
                "Goal17to20"
            ])
예제 #4
0
import os, json
from datetime import datetime, timedelta
from analytics.connectors.mainReport import Report
from analytics.connectors import access_data

date_from = datetime.strftime(datetime.today() - timedelta(days=1), "%Y-%m-%d")
date_to = datetime.strftime(datetime.today() - timedelta(days=1), "%Y-%m-%d")

clients = json.load(
    open(
        os.path.join(
            os.path.split(os.getcwd())[0], "json_files", "clients.json"), "r"))
for client, placement in clients.items():
    fb_params = placement.get('mytarget', None)
    if fb_params:
        project = placement['bigquery']['project']
        path_to_bq = os.path.join(
            access_data.path_to_json,
            access_data.name_json_files['project'][project]['path_to_bq'])

        for params in fb_params:
            report = Report(client, path_to_bq, date_from, date_to)
            report.get_mytarget_report(
                access_data.MyTarget[params['client_id']], 3,
                params['client_id'])
예제 #5
0
import os, json
from datetime import datetime, timedelta
from analytics.connectors.mainReport import Report
from analytics.connectors import access_data

date_from = datetime.strftime(datetime.today() - timedelta(days=1), "%Y-%m-%d")
date_to = datetime.strftime(datetime.today() - timedelta(days=1), "%Y-%m-%d")

clients = json.load(
    open(
        os.path.join(
            os.path.split(os.getcwd())[0], "json_files", "clients.json"), "r"))
for client, placement in clients.items():
    vk_params = placement.get('vkontakte', None)
    if vk_params:
        project = placement['bigquery']['project']
        path_to_bq = os.path.join(
            access_data.path_to_json,
            access_data.name_json_files['project'][project]['path_to_bq'])

        for params in vk_params:
            report = Report(client, path_to_bq, date_from, date_to)
            report.get_vkontakte_report(access_data.vkontakte_token_general,
                                        params['account_id'],
                                        params['client_id'])
예제 #6
0
import os, json
from datetime import datetime, timedelta
from analytics.connectors.mainReport import Report
from analytics.connectors import access_data

project = 't-isobar'
path_to_bq = os.path.join(access_data.path_to_json,
                          access_data.name_json_files['project'][project]['path_to_bq'])

date_from = datetime.strftime(datetime.today() - timedelta(days=1), "%Y-%m-%d")
date_to = datetime.strftime(datetime.today() - timedelta(days=1), "%Y-%m-%d")
report = Report("TRAFFIC", path_to_bq, date_from, date_to)

list_of_logins = report.get_yandex_direct_agency_clients(access_data.yandex_token_general)


clients = json.load(open(os.path.join(os.path.split(os.getcwd())[0], "json_files", "clients.json"), "r"))
for client, placement in clients.items():
    yandex_params = placement.get('yandex', None)
    if yandex_params:
        project = placement['bigquery']['project']
        path_to_bq = os.path.join(access_data.path_to_json,
                                  access_data.name_json_files['project'][project]['path_to_bq'])

        for params in yandex_params:

            report = Report(client, path_to_bq, date_from, date_to)
            report.get_yandex_report(params['Login'], access_data.yandex_token_general, 5,
                                     ["CAMPAIGN_STAT", "CAMPAIGN_GEO_STAT", "CAMPAIGN_SOCDEM_DEVICE_STAT", "AD_STAT"])
import os, json
from datetime import datetime, timedelta
from analytics.connectors.mainReport import Report
from analytics.connectors import access_data

date_from = "2020-04-16"
date_to = "2020-04-23"

clients = json.load(open(os.path.join(os.path.split(os.getcwd())[0], "json_files", "clients.json"), "r"))
for client, placement in clients.items():
    if client == "LENTA":
        client = client + "_CID"
        analytics_params = placement.get('analytics', None)
        if analytics_params:
            project = placement['bigquery']['project']
            path_to_bq = os.path.join(access_data.path_to_json,
                                      access_data.name_json_files['project'][project]['path_to_bq'])

            path_to_ga = os.path.join(access_data.path_to_json,
                                      access_data.name_json_files['project'][project]['path_to_ga'])

            for params in analytics_params:

                report = Report(client, path_to_bq, date_from, date_to)
                report.get_analytics_report(params['view_id'], path_to_ga, ["GeneralByClientID"])

예제 #8
0
project = 't-isobar'
conversions_list = [
    96762097, 96762190, 96762199, 96762244, 96762481, 96762514, 96762970,
    96762976, 96762988, 96762994, 96763231, 96763237
]
path_to_bq = os.path.join(
    access_data.path_to_json,
    access_data.name_json_files['project'][project]['path_to_bq'])

date_from = datetime.strftime(datetime.today() - timedelta(days=1), "%Y-%m-%d")
date_to = datetime.strftime(datetime.today() - timedelta(days=1), "%Y-%m-%d")

clients = json.load(
    open(
        os.path.join(
            os.path.split(os.getcwd())[0], "json_files", "clients.json"), "r"))
for client, placement in clients.items():
    yandex_params = placement.get('metrica', None)
    if yandex_params:
        project = placement['bigquery']['project']
        path_to_bq = os.path.join(
            access_data.path_to_json,
            access_data.name_json_files['project'][project]['path_to_bq'])
        for params in yandex_params:
            report = Report(client, path_to_bq, date_from, date_to)
            report.get_metrica_report(access_data.yandex_token_general,
                                      params['count_id'],
                                      ["BASE", "CONVERSIONS"],
                                      conversions_list)
예제 #9
0
import os, json
from datetime import datetime, timedelta
from analytics.connectors.mainReport import Report
from analytics.connectors import access_data

date_from = datetime.strftime(datetime.today() - timedelta(days=1), "%Y-%m-%d")
date_to = datetime.strftime(datetime.today() - timedelta(days=1), "%Y-%m-%d")

clients = json.load(
    open(
        os.path.join(
            os.path.split(os.getcwd())[0], "json_files", "clients.json"), "r"))

for client, placement in clients.items():
    yandex_params = placement.get('yandex', None)
    if yandex_params:
        project = placement['bigquery']['project']
        path_to_bq = os.path.join(
            access_data.path_to_json,
            access_data.name_json_files['project'][project]['path_to_bq'])

        for params in yandex_params:
            yandex = Report(client, path_to_bq, date_from, date_to)
            yandex.get_yandex_direct_objects(access_data.yandex_token_general,
                                             "suprastinex2020")