Skip to main content

heuristic_models

Python

#Load library and data

import pandas as pd

from ChannelAttributionPro import *

import urllib.request

Data = pd.read_csv("https://channelattribution.io/csv/Data.csv",sep=";")

password="yourpassword"

#Perform transaction level attribution from a data.frame

path_attribution=heuristic_models(Data=Data, var_path="path", var_conv="total_conversions",
var_value="total_conversion_value", cha_sep=">",
password=password)
print(path_attribution)

#Return non converting paths in the output data.frame

path_attribution=heuristic_models(Data=Data, var_path="path", var_conv="total_conversions",
var_value="total_conversion_value", cha_sep=">",
flg_write_nulls=1, password=password)
print(path_attribution)

#Return paths in the output data.frame

path_attribution=heuristic_models(Data=Data, var_path="path", var_conv="total_conversions",
var_value="total_conversion_value", cha_sep=">",
flg_write_paths=1, password=password)
print(path_attribution)


#Perform transaction level attribution from a file and write output to file

res=heuristic_models(Data="Data.csv", var_path="path", var_conv="total_conversions",
var_value="total_conversion_value", cha_sep=">", row_sep=";",
file_output="ouput.csv", password=password)
path_attribution = pd.read_csv("ouput.csv",sep=";")
print(res)

R

#Load library and data

library(ChannelAttributionPro)

data(PathData)

password="yourpassword"

#Perform transaction level attribution from a data.frame

path_attribution=heuristic_models(Data=Data, var_path="path", var_conv="total_conversions",
var_value="total_conversion_value", cha_sep=">",
password=password)
print(path_attribution,max=100)

#Return non converting paths in the output data.frame

path_attribution=heuristic_models(Data=Data, var_path="path", var_conv="total_conversions",
var_value="total_conversion_value", cha_sep=">",
flg_write_nulls=1, password=password)
print(path_attribution,max=100)

#Return paths in the output data.frame

path_attribution=heuristic_models(Data=Data, var_path="path", var_conv="total_conversions",
var_value="total_conversion_value", cha_sep=">",
flg_write_nulls=1, password=password)
print(path_attribution,max=100)

#Perform transaction level attribution from a file and write output to file

res=heuristic_models(Data="Data.csv", var_path="path", var_conv="total_conversions",
var_value="total_conversion_value", cha_sep=">", row_sep=";",
file_output="ouput.csv", password=password)
print(res)