Package 'rlinkedinads'

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

Help Index


Authorization in Linkedin API

Description

Authorization in Linkedin API. For more details see link.

Usage

lkd_auth(login = Sys.getenv("LKD_LOGIN"))

Arguments

login

your Linkedin login

Value

No return value, just take API token

Examples

## 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

Description

Get account list

Usage

lkd_get_accounts(start = 0, count = 1000)

Arguments

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.

Value

tibble with account metadata


Find Ad Accounts by Authenticated User All ad accounts that an authenticated user has access

Description

Find Ad Accounts by Authenticated User All ad accounts that an authenticated user has access

Usage

lkd_get_accounts_by_authenticated_user(start = 0, count = 1000)

Arguments

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.

Value

tibble with accounts list


Find Ad Account Users by Accounts Fetch all users associated with a specific ad account. See next link.

Description

Find Ad Account Users by Accounts Fetch all users associated with a specific ad account. See next link.

Usage

lkd_get_ad_account_users_by_accounts(account_urn_id, start = 0, count = 1000)

Arguments

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.

Value

tibble with users list


Get Linkedin ads analytics The Analytics Finder should be used when specifying a single pivot.

Description

Get Linkedin ads analytics The Analytics Finder should be used when specifying a single pivot.

Usage

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"),
  ...
)

Arguments

pivot

String. Pivot of results, by which each report data point is grouped.

  • COMPANY - Group results by advertiser's company

  • ACCOUNT - Group results by account.

  • SHARE - Group results by sponsored share.

  • CAMPAIGN - Group results by campaign.

  • CREATIVE - Group results by creative.

  • CAMPAIGN_GROUP - Group results by campaign group.

  • CONVERSION - Group results by conversion.

  • CONVERSATION_NODE - The element row in the conversation will be the information for each individual node of the conversation tree.

  • CONVERSATION_NODE_OPTION_INDEX - Used actionClicks are deaggregated and reported at the Node Button level. The second value of the pivot_values will be the index of the button in the node.

  • SERVING_LOCATION - Group results by serving location, onsite or offsite.

  • CARD_INDEX - Group results by the index of where a card appears in a carousel ad creative. Metrics are based on the index of the card at the time when the user's action (impression, click, etc.) happened on the creative (Carousel creatives only).

  • MEMBER_COMPANY_SIZE - Group results by member company size.

  • MEMBER_INDUSTRY - Group results by member industry.

  • MEMBER_SENIORITY - Group results by member seniority.

  • MEMBER_JOB_TITLE - Group results by member job title.

  • MEMBER_JOB_FUNCTION - Group results by member job function.

  • MEMBER_COUNTRY_V2 - Group results by member country.

  • MEMBER_REGION_V2 - Group results by member region.

  • MEMBER_COMPANY - Group results by member company.

  • PLACEMENT_NAME - Group results by placement.

  • IMPRESSION_DEVICE_TYPE - Group results by the device type the ad made an impression on. Reach metrics and conversion metrics will not be available when this pivot is used.

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:

  • ALL - Results grouped into a single result across the entire time range of the report.

  • DAILY - Results grouped by day.

  • MONTHLY - Results grouped by month.

  • YEARLY - Results grouped by year.

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:

  • COST_IN_LOCAL_CURRENCY

  • IMPRESSIONS

  • CLICKS

  • ONE_CLICK_LEADS

  • OPENS

  • SENDS

  • EXTERNAL_WEBSITE_CONVERSIONS

sort_by_order

String. The order of the results. Supported values include:

  • ASCENDING

  • DESCENDING

...

Faceting parameter For more details see next link.You must specify at least one of:

  • shares - Match result by share facets. Defaults to empty.

  • campaigns - Match result by campaign facets. Defaults to empty. For example campaigns = c('urn:li:sponsoredCampaign:253102116', 'urn:li:sponsoredCampaign:276103383').

  • creatives - Match result by creative facets. Defaults to empty.

  • campaignGroups - Match result by campaign group facets. Defaults to empty.

  • accounts - Match result by sponsored ad account facets. Defaults to empty. For example accounts = 'urn:li:sponsoredAccount:511009658'.

  • companies - Match result by company facets. Defaults to empty.

Value

tibble with report

Examples

## 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.

Description

Get Ad campaign Groups Campaign groups provide advertisers a way to manage status, budget, and performance across multiple related campaigns.

Usage

lkd_get_campaign_groups(
  account_id = lkd_get_account_id(),
  test = FALSE,
  start = 0,
  count = 1000
)

Arguments

account_id

your Linkedin Ad Account ID

test

Searches for campaigns based on test or non-test status:

  • True: for test campaigns

  • False: for non-test campaigns If not specified, searches for both test and non-test campaigns.

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.

Value

tibble with campaign groups metadata


Get campaigns

Description

Get campaigns

Usage

lkd_get_campaigns(
  account_id = lkd_get_account_id(),
  test = FALSE,
  start = 0,
  count = 1000
)

Arguments

account_id

your Linkedin Ad Account ID

test

Searches for campaigns based on test or non-test status:

  • True: for test campaigns

  • False: for non-test campaigns If not specified, searches for both test and non-test campaigns.

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.

Value

tibble with campaign metadata


Get Creatives You can search for creative content in order to get a collection of creatives matching

Description

Get Creatives You can search for creative content in order to get a collection of creatives matching

Usage

lkd_get_creatives(account_id = lkd_get_account_id(), start = 0, count = 1000)

Arguments

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.

Value

tibble with creatives metadata


remove token

Description

remove token

Usage

lkd_remove_token(login = lkd_get_login())

Arguments

login

your login at Linkedin

Value

no return value, just remove token cacche


Set Ad Account ID for R session

Description

Set Ad Account ID for R session

Usage

lkd_set_account_id(account_id)

Arguments

account_id

Id of your ad account

Value

no return value


Set Linkedin API version For dwtwils se next link

Description

Set Linkedin API version For dwtwils se next link

Usage

lkd_set_api_version(api_version)

Arguments

api_version

Linkedin API version

Value

no return value


Set App Client ID For more information see this links.

Description

Set App Client ID For more information see this links.

Usage

lkd_set_client_id(client_id)

Arguments

client_id

you linkedin APP ID

Value

no return value


Set App Client secret For more information see this links.

Description

Set App Client secret For more information see this links.

Usage

lkd_set_client_secret(client_secret)

Arguments

client_secret

Your APP secret

Value

no return value


Set login for current R session

Description

Set login for current R session

Usage

lkd_set_login(login)

Arguments

login

Your Linkedin login

Value

no return value


Set own token cache path

Description

Set own token cache path

Usage

lkd_set_token_path(token_path)

Arguments

token_path

Path to cache folder

Value

no return value