Title: | Load Data from 'Linkedin Advertising API' |
---|---|
Description: | Get data from 'Linkedin Advertising API' <https://learn.microsoft.com/en-us/linkedin/marketing/overview>. You can load ad account hierarchy (accounts, users, campaign groups, campaigns and creatives) and also you can load ad analytics data from your 'Linkedin' Ad account. |
Authors: | Alexey Seleznev [aut, cre] |
Maintainer: | Alexey Seleznev <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.2.0.9000 |
Built: | 2025-01-26 06:11:38 UTC |
Source: | https://github.com/selesnow/rlinkedinads |
Authorization in Linkedin API. For more details see link.
lkd_auth(login = Sys.getenv("LKD_LOGIN"))
lkd_auth(login = Sys.getenv("LKD_LOGIN"))
login |
your Linkedin login |
No return value, just take API token
## Not run: # set auth data lkd_set_client_id('Your client id') lkd_set_client_secret('Your client secret') lkd_set_login('Your linkedin login') lkd_auth() ## End(Not run)
## Not run: # set auth data lkd_set_client_id('Your client id') lkd_set_client_secret('Your client secret') lkd_set_login('Your linkedin login') lkd_auth() ## End(Not run)
Get account list
lkd_get_accounts(start = 0, count = 1000)
lkd_get_accounts(start = 0, count = 1000)
start |
Integer, paggination. The index of the first item you want results for. |
count |
Integer, pagination. The number of items you want included on each page of results. There could be fewer items remaining than the value you specify. |
tibble with account metadata
Find Ad Accounts by Authenticated User All ad accounts that an authenticated user has access
lkd_get_accounts_by_authenticated_user(start = 0, count = 1000)
lkd_get_accounts_by_authenticated_user(start = 0, count = 1000)
start |
Integer, paggination. The index of the first item you want results for. |
count |
Integer, pagination. The number of items you want included on each page of results. There could be fewer items remaining than the value you specify. |
tibble with accounts list
Find Ad Account Users by Accounts Fetch all users associated with a specific ad account. See next link.
lkd_get_ad_account_users_by_accounts(account_urn_id, start = 0, count = 1000)
lkd_get_ad_account_users_by_accounts(account_urn_id, start = 0, count = 1000)
account_urn_id |
accounts ID with a sponsoredAccount URN |
start |
Integer, paggination. The index of the first item you want results for. |
count |
Integer, pagination. The number of items you want included on each page of results. There could be fewer items remaining than the value you specify. |
tibble with users list
Get Linkedin ads analytics The Analytics Finder should be used when specifying a single pivot.
lkd_get_ads_analytics( pivot = c("COMPANY", "ACCOUNT", "SHARE", "CAMPAIGN", "CREATIVE", "CAMPAIGN_GROUP", "CONVERSION", "CONVERSATION_NODE", "CONVERSATION_NODE_OPTION_INDEX", "SERVING_LOCATION", "CARD_INDEX", "MEMBER_COMPANY_SIZE", "MEMBER_INDUSTRY", "MEMBER_SENIORITY", "MEMBER_JOB_TITLE", "MEMBER_JOB_FUNCTION", "MEMBER_COUNTRY_V2", "MEMBER_REGION_V2", "MEMBER_COMPANY"), fields = c("pivotValues", "dateRange", "clicks", "impressions", "dateRange", "costInUsd", "oneClickLeads", "externalWebsiteConversions"), date_from = Sys.Date() - 31, date_to = Sys.Date() - 1, time_granularity = c("DAILY", "ALL", "MONTHLY", "YEARLY"), campaign_type = NULL, sort_by_fields = c("", "COST_IN_LOCAL_CURRENCY", "IMPRESSIONS", "ONE_CLICK_LEADS", "OPENS", "SENDS", "EXTERNAL_WEBSITE_CONVERSIONS"), sort_by_order = c("", "ASCENDING", "DESCENDING"), ... )
lkd_get_ads_analytics( pivot = c("COMPANY", "ACCOUNT", "SHARE", "CAMPAIGN", "CREATIVE", "CAMPAIGN_GROUP", "CONVERSION", "CONVERSATION_NODE", "CONVERSATION_NODE_OPTION_INDEX", "SERVING_LOCATION", "CARD_INDEX", "MEMBER_COMPANY_SIZE", "MEMBER_INDUSTRY", "MEMBER_SENIORITY", "MEMBER_JOB_TITLE", "MEMBER_JOB_FUNCTION", "MEMBER_COUNTRY_V2", "MEMBER_REGION_V2", "MEMBER_COMPANY"), fields = c("pivotValues", "dateRange", "clicks", "impressions", "dateRange", "costInUsd", "oneClickLeads", "externalWebsiteConversions"), date_from = Sys.Date() - 31, date_to = Sys.Date() - 1, time_granularity = c("DAILY", "ALL", "MONTHLY", "YEARLY"), campaign_type = NULL, sort_by_fields = c("", "COST_IN_LOCAL_CURRENCY", "IMPRESSIONS", "ONE_CLICK_LEADS", "OPENS", "SENDS", "EXTERNAL_WEBSITE_CONVERSIONS"), sort_by_order = c("", "ASCENDING", "DESCENDING"), ... )
pivot |
String. Pivot of results, by which each report data point is grouped.
|
fields |
String vector of report metrics. You can find list of actual metrics here. |
date_from |
Date. Represents the inclusive start time range of the analytics. If unset, it indicates an open range up to the end time. |
date_to |
Date. Represents the inclusive end time range of the analytics. Must be after start time if it's present. If unset, it indicates an open range from start time to everything after. |
time_granularity |
String. Time granularity of results. Valid enum values:
|
campaign_type |
String. Match result by a campaign type. Supported types are: TEXT_AD, SPONSORED_UPDATES, SPONSORED_INMAILS, DYNAMIC. Requires at least one other facet. Defaults to empty. |
sort_by_fields |
String. The field by which the results are sorted. Supported values include:
|
sort_by_order |
String. The order of the results. Supported values include:
|
... |
Faceting parameter For more details see next link.You must specify at least one of:
|
tibble with report
## Not run: stat <- lkd_get_ads_analytics( pivot = 'CAMPAIGN', date_from = '2023-09-01', date_to = '2023-09-30', time_granularity = 'DAILY', fields = c( 'pivotValues', 'dateRange', 'clicks', 'impressions', 'dateRange', 'costInUsd', 'oneClickLeads', 'externalWebsiteConversions' ), accounts = 'urn:li:sponsoredAccount:511009658', campaigns = c( 'urn:li:sponsoredCampaign:253102116', 'urn:li:sponsoredCampaign:276103383' ) ) ## End(Not run)
## Not run: stat <- lkd_get_ads_analytics( pivot = 'CAMPAIGN', date_from = '2023-09-01', date_to = '2023-09-30', time_granularity = 'DAILY', fields = c( 'pivotValues', 'dateRange', 'clicks', 'impressions', 'dateRange', 'costInUsd', 'oneClickLeads', 'externalWebsiteConversions' ), accounts = 'urn:li:sponsoredAccount:511009658', campaigns = c( 'urn:li:sponsoredCampaign:253102116', 'urn:li:sponsoredCampaign:276103383' ) ) ## End(Not run)
Get Ad campaign Groups Campaign groups provide advertisers a way to manage status, budget, and performance across multiple related campaigns.
lkd_get_campaign_groups( account_id = lkd_get_account_id(), test = FALSE, start = 0, count = 1000 )
lkd_get_campaign_groups( account_id = lkd_get_account_id(), test = FALSE, start = 0, count = 1000 )
account_id |
your Linkedin Ad Account ID |
test |
Searches for campaigns based on test or non-test status:
|
start |
Integer, paggination. The index of the first item you want results for. |
count |
Integer, pagination. The number of items you want included on each page of results. There could be fewer items remaining than the value you specify. |
tibble with campaign groups metadata
Get campaigns
lkd_get_campaigns( account_id = lkd_get_account_id(), test = FALSE, start = 0, count = 1000 )
lkd_get_campaigns( account_id = lkd_get_account_id(), test = FALSE, start = 0, count = 1000 )
account_id |
your Linkedin Ad Account ID |
test |
Searches for campaigns based on test or non-test status:
|
start |
Integer, paggination. The index of the first item you want results for. |
count |
Integer, pagination. The number of items you want included on each page of results. There could be fewer items remaining than the value you specify. |
tibble with campaign metadata
Get Creatives You can search for creative content in order to get a collection of creatives matching
lkd_get_creatives(account_id = lkd_get_account_id(), start = 0, count = 1000)
lkd_get_creatives(account_id = lkd_get_account_id(), start = 0, count = 1000)
account_id |
your Linkedin Ad Account ID |
start |
Integer, paggination. The index of the first item you want results for. |
count |
Integer, pagination. The number of items you want included on each page of results. There could be fewer items remaining than the value you specify. |
tibble with creatives metadata
remove token
lkd_remove_token(login = lkd_get_login())
lkd_remove_token(login = lkd_get_login())
login |
your login at Linkedin |
no return value, just remove token cacche
Set Ad Account ID for R session
lkd_set_account_id(account_id)
lkd_set_account_id(account_id)
account_id |
Id of your ad account |
no return value
Set Linkedin API version For dwtwils se next link
lkd_set_api_version(api_version)
lkd_set_api_version(api_version)
api_version |
Linkedin API version |
no return value
Set App Client ID For more information see this links.
lkd_set_client_id(client_id)
lkd_set_client_id(client_id)
client_id |
you linkedin APP ID |
no return value
Set App Client secret For more information see this links.
lkd_set_client_secret(client_secret)
lkd_set_client_secret(client_secret)
client_secret |
Your APP secret |
no return value
Set login for current R session
lkd_set_login(login)
lkd_set_login(login)
login |
Your Linkedin login |
no return value
Set own token cache path
lkd_set_token_path(token_path)
lkd_set_token_path(token_path)
token_path |
Path to cache folder |
no return value