Package com.facebook.capi.sdk.utils
Class CookieUtils
java.lang.Object
com.facebook.capi.sdk.utils.CookieUtils
Util functions to help process and provide suggestions on the cookies
-
Constructor Summary
ConstructorsConstructorDescriptionCookieUtils(List<FbcParamConfig> fbcParamConfigs) Default settings for param configs -
Method Summary
Modifier and TypeMethodDescriptiongetNewFbcPayloadFromQuery(Map<String, String[]> queries, String referrer) Get the new fbc payload from query string and referrer.getUpdatedFbcCookie(String existingFbc, String newFbcPayload, Map<String, CookieSetting> updatedCookiesMap) Check if we need update fbc cookie.getUpdatedFbpCookie(String existingFbp, Map<String, CookieSetting> updatedCookieMap) Check if we need update fbp cookie.preprocessCookies(Map<String, String> cookies, String cookieName, Map<String, CookieSetting> updatedCookieMap) Preprocess cookies to make sure we have the correct language token.voidsetEtldPlusOneAndSubDomainIndex(String etldPlusOne, int subdoainIndex) Set the default value for etldPlusOne and subdoainIndex
-
Constructor Details
-
CookieUtils
Default settings for param configs- Parameters:
fbcParamConfigs- default setting configs
-
-
Method Details
-
setEtldPlusOneAndSubDomainIndex
Set the default value for etldPlusOne and subdoainIndex- Parameters:
etldPlusOne- reset etld+1subdoainIndex- reset subdomain index
-
preprocessCookies
public String preprocessCookies(Map<String, String> cookies, String cookieName, Map<String, CookieSetting> updatedCookieMap) Preprocess cookies to make sure we have the correct language token. If not, update the cookie- Parameters:
cookies- Map of cookies. Key is cookie name, value is cookie valuecookieName- Cookie name to be processedupdatedCookieMap- A map to store updated cookies. key is the cookie name, value is CookieSettings. If cookie already exist and no need update, return null.- Returns:
- updated cookie value. Return null if current cookie value is empty or invalid.
-
getNewFbcPayloadFromQuery
Get the new fbc payload from query string and referrer.- Parameters:
queries- Map of query stringreferrer- full referrer url- Returns:
- new updated fbc payload
-
getUpdatedFbpCookie
public CookieSetting getUpdatedFbpCookie(String existingFbp, Map<String, CookieSetting> updatedCookieMap) Check if we need update fbp cookie. If yes, update it and return the new fbp cookie.- Parameters:
existingFbp- existing fbp cookie valueupdatedCookieMap- A map to store updated cookies. key is the cookie name, value is CookieSettings. If cookie already exist and no need update, return null.- Returns:
- CookieSettings that should be updated. If cookie already exist and no need update return null.
-
getUpdatedFbcCookie
public CookieSetting getUpdatedFbcCookie(String existingFbc, String newFbcPayload, Map<String, CookieSetting> updatedCookiesMap) Check if we need update fbc cookie. If yes, update it and return the new fbc cookie.- Parameters:
existingFbc- existing fbc payloadnewFbcPayload- new fbc payloadupdatedCookiesMap- A map to store updated cookies. key is the cookie name, value is CookieSettings- Returns:
- CookieSettings that should be updated. If cookie already exist and no need update return null.
-