Integracja WooCommerce z BigQuery

Dowiedz się, jak połączyć WooCommerce z Google BigQuery w WitCloud, aby pobierać zamówienia, produkty i kategorie produktów ze sklepu.

Aktualizacja

Wprowadzenie

Ten moduł łączy Twój sklep WooCommerce z Google Cloud BigQuery. WitCloud odczytuje zamówienia, produkty i kategorie produktów przez WooCommerce REST API i zapisuje je w datasecie BigQuery Twojego projektu, gotowe do analizy i do tabel All in One.

Przewodnik konfiguracji

Wykonaj poniższe kroki, aby połączyć WooCommerce z BigQuery. WitCloud potrzebuje adresu Twojego sklepu i pary kluczy WooCommerce REST API (consumer key i consumer secret).

Utwórz klucz REST API przed rozpoczęciem: wkleisz go w WitCloud w kroku Autoryzacja. Wystarczy uprawnienie tylko do odczytu, ponieważ WitCloud tylko odczytuje dane ze sklepu.

Utwórz klucz REST API w WooCommerce

Ten krok wykonujesz w panelu administracyjnym WordPress / WooCommerce, który nie jest częścią WitCloud. Nazwy menu poniżej pochodzą z WooCommerce i mogą się różnić w zależności od jego wersji. Jeśli nie możesz ich znaleźć, zajrzyj do dokumentacji WooCommerce.

  1. Zaloguj się do panelu administracyjnego WordPress jako administrator.
  2. Przejdź do WooCommerce > Settings > Advanced > REST API i kliknij Add key.
  3. Wpisz opis, np. „WitCloud”, wybierz użytkownika i ustaw Permissions na Read.
  4. Kliknij Generate API key.
  5. Skopiuj Consumer key (zaczyna się od ck_) i Consumer secret (zaczyna się od cs_). WooCommerce pokazuje secret tylko raz.

Zachowaj obie wartości w tajemnicy: każdy, kto je ma, może odczytać dane Twojego sklepu.

Konfiguracja modułu

Przejdź do Integracje i kliknij Dodaj integrację.

Lista integracji z przyciskiem Dodaj integrację

Wybierz WooCommerce z listy dostępnych integracji.

Katalog integracji zawężony do WooCommerce

Wpisz Nazwa źródła danych, np. „WooCommerce PL”. Czytelna nazwa pomoże Ci później rozpoznać źródło danych.

Pole Nazwa źródła danych wypełnione przykładową nazwą WooCommerce PL

Wpisz Adres URL sklepu: adres Twojego sklepu razem z https://, np. https://your-shop.com. Przycisk Autoryzuj jest nieaktywny, dopóki nie wpiszesz poprawnego adresu.

Pole Adres URL sklepu wypełnione przykładowym adresem https://demo-shop.example

Autoryzacja

Jeśli ten sklep WooCommerce został już autoryzowany w WitCloud, wybierz istniejący token z listy Autoryzacja WooCommerce i pomiń dwa kolejne kroki.

Kliknij Autoryzuj.

Przycisk Autoryzuj obok pola Autoryzacja WooCommerce, aktywny po wpisaniu adresu sklepu

W oknie Autoryzuj wpisz Identyfikator klienta (Client ID) (to consumer key z WooCommerce) i Sekret klienta (Client secret) (to consumer secret z WooCommerce), a następnie kliknij Utwórz. WitCloud sprawdza klucz w Twoim sklepie. Jeśli sklep jest nieosiągalny, adres lub klucz jest błędny albo klucz nie ma uprawnień do odczytu danych, powód pojawi się pod formularzem.

Okno Autoryzuj z polami Identyfikator klienta (Client ID) i Sekret klienta (Client secret) wypełnionymi przykładowymi wartościami

Zapisany token zostanie wybrany automatycznie. Token możesz też wybrać z listy Autoryzacja WooCommerce.

Otwarta lista Autoryzacja WooCommerce z jednym przykładowym tokenem

Ustawienia zaawansowane

Kliknij Pokaż ustawienia zaawansowane, aby zobaczyć trzy kolejne pola.

W polu Odświeżanie danych (produkty, stany magazynowe) wpisz, co ile godzin mają być odświeżane tabele przechowujące cały katalog (takie jak produkty). Wartość musi mieścić się między 4 a 12 godzin; domyślnie jest to 4.

Otwarte ustawienia zaawansowane z polem Odświeżanie danych (produkty, stany magazynowe) ustawionym na 4 godziny

Włącz Stały adres IP, jeśli Twój sklep jest za dodatkową ochroną sieciową, np. Cloudflare. Wszystkie zapytania o dane wychodzą wtedy z jednego stałego adresu IP, 34.118.32.227, który możesz dodać do listy dozwolonych adresów swojego sklepu.

Przełącznik Stały adres IP w ustawieniach zaawansowanych

W polu Tabele do pobrania możesz usunąć tabele, których nie potrzebujesz. Pole oferuje orders, products, categories i returns; domyślnie wszystkie są zaznaczone, a co najmniej jedna musi pozostać zaznaczona. Pobieranie mniejszej liczby tabel przyspiesza pobieranie danych.

Pole Tabele do pobrania z wybranymi wszystkimi czterema oferowanymi tabelami

Kliknij Dalej.

Wypełnione ustawienia źródła danych z przyciskiem Dalej

Dane historyczne i harmonogram

W polu Dane historyczne wpisz liczbę dni do pobrania przy pierwszym uruchomieniu, maksymalnie 365.

Pole Dane historyczne wypełnione wartością 365 dni

Harmonogram synchronizacji danych tworzy się automatycznie. Więcej informacji na ten temat znajdziesz tutaj.

Kliknij Utwórz, aby zakończyć konfigurację.

Ustawienia pobierania danych z przyciskiem Utwórz

Gotowe! Dane z WooCommerce będą teraz synchronizowane z BigQuery. Zamówienia są pobierane dzień po dniu, a produkty i kategorie pobierane są w całości przy każdym uruchomieniu.

Schemat danych

Poniższe tabele pokazują dane pobierane z WooCommerce: zamówienia, produkty i kategorie produktów.

Schemat danych tabeli woocommerce_categories
Field NameModeType
countNULLABLEINTEGER
descriptionNULLABLESTRING
displayNULLABLESTRING
idNULLABLEINTEGER
imageNULLABLERECORD
image.altNULLABLESTRING
image.date_createdNULLABLETIMESTAMP
image.date_created_gmtNULLABLETIMESTAMP
image.date_modifiedNULLABLETIMESTAMP
image.date_modified_gmtNULLABLETIMESTAMP
image.idNULLABLEINTEGER
image.nameNULLABLESTRING
image.srcNULLABLESTRING
menu_orderNULLABLEINTEGER
nameNULLABLESTRING
parentNULLABLEINTEGER
slugNULLABLESTRING
Schemat danych tabeli woocommerce_orders
Field NameModeType
billingNULLABLERECORD
billing.address_1NULLABLESTRING
billing.address_2NULLABLESTRING
billing.cityNULLABLESTRING
billing.companyNULLABLESTRING
billing.countryNULLABLESTRING
billing.emailNULLABLESTRING
billing.first_nameNULLABLESTRING
billing.last_nameNULLABLESTRING
billing.phoneNULLABLESTRING
billing.postcodeNULLABLESTRING
billing.stateNULLABLESTRING
cart_hashNULLABLESTRING
cart_taxNULLABLEFLOAT
coupon_linesREPEATEDRECORD
coupon_lines.codeNULLABLESTRING
coupon_lines.discountNULLABLEFLOAT
coupon_lines.discount_taxNULLABLEFLOAT
coupon_lines.idNULLABLEINTEGER
coupon_lines.meta_dataREPEATEDRECORD
coupon_lines.meta_data.display_keyNULLABLESTRING
coupon_lines.meta_data.display_valueNULLABLEJSON
coupon_lines.meta_data.idNULLABLEINTEGER
coupon_lines.meta_data.keyNULLABLESTRING
coupon_lines.meta_data.valueNULLABLEJSON
created_viaNULLABLESTRING
currencyNULLABLESTRING
currency_symbolNULLABLESTRING
customer_idNULLABLEINTEGER
customer_ip_addressNULLABLESTRING
customer_noteNULLABLESTRING
customer_user_agentNULLABLESTRING
date_completedNULLABLETIMESTAMP
date_completed_gmtNULLABLETIMESTAMP
date_createdNULLABLETIMESTAMP
date_created_gmtNULLABLETIMESTAMP
date_modifiedNULLABLETIMESTAMP
date_modified_gmtNULLABLETIMESTAMP
date_paidNULLABLETIMESTAMP
date_paid_gmtNULLABLETIMESTAMP
discount_taxNULLABLEFLOAT
discount_totalNULLABLEFLOAT
idNULLABLEINTEGER
is_editableNULLABLEBOOLEAN
line_itemsREPEATEDRECORD
line_items.idNULLABLEINTEGER
line_items.imageNULLABLERECORD
line_items.image.idNULLABLEINTEGER
line_items.image.srcNULLABLESTRING
line_items.meta_dataREPEATEDRECORD
line_items.meta_data.display_keyNULLABLESTRING
line_items.meta_data.display_valueNULLABLEJSON
line_items.meta_data.idNULLABLEINTEGER
line_items.meta_data.keyNULLABLESTRING
line_items.meta_data.valueNULLABLEJSON
line_items.nameNULLABLESTRING
line_items.priceNULLABLEFLOAT
line_items.product_idNULLABLEINTEGER
line_items.quantityNULLABLEINTEGER
line_items.skuNULLABLESTRING
line_items.subtotalNULLABLEFLOAT
line_items.subtotal_taxNULLABLEFLOAT
line_items.tax_classNULLABLESTRING
line_items.taxesREPEATEDRECORD
line_items.taxes.idNULLABLEINTEGER
line_items.taxes.subtotalNULLABLEFLOAT
line_items.taxes.totalNULLABLEFLOAT
line_items.totalNULLABLEFLOAT
line_items.total_taxNULLABLEFLOAT
line_items.variation_idNULLABLEINTEGER
meta_dataREPEATEDRECORD
meta_data.idNULLABLEINTEGER
meta_data.keyNULLABLESTRING
meta_data.valueNULLABLEJSON
needs_paymentNULLABLEBOOLEAN
needs_processingNULLABLEBOOLEAN
numberNULLABLEINTEGER
order_keyNULLABLESTRING
parent_idNULLABLEINTEGER
payment_methodNULLABLESTRING
payment_method_titleNULLABLESTRING
payment_urlNULLABLESTRING
prices_include_taxNULLABLEBOOLEAN
shippingNULLABLERECORD
shipping.address_1NULLABLESTRING
shipping.address_2NULLABLESTRING
shipping.cityNULLABLESTRING
shipping.companyNULLABLESTRING
shipping.countryNULLABLESTRING
shipping.first_nameNULLABLESTRING
shipping.last_nameNULLABLESTRING
shipping.phoneNULLABLESTRING
shipping.postcodeNULLABLESTRING
shipping.stateNULLABLESTRING
shipping_linesREPEATEDRECORD
shipping_lines.idNULLABLEINTEGER
shipping_lines.instance_idNULLABLEINTEGER
shipping_lines.meta_dataREPEATEDRECORD
shipping_lines.meta_data.display_keyNULLABLESTRING
shipping_lines.meta_data.display_valueNULLABLEJSON
shipping_lines.meta_data.idNULLABLEINTEGER
shipping_lines.meta_data.keyNULLABLESTRING
shipping_lines.meta_data.valueNULLABLEJSON
shipping_lines.method_idNULLABLESTRING
shipping_lines.method_titleNULLABLESTRING
shipping_lines.totalNULLABLEFLOAT
shipping_lines.total_taxNULLABLEFLOAT
shipping_taxNULLABLEFLOAT
shipping_totalNULLABLEFLOAT
statusNULLABLESTRING
summary_pageNULLABLESTRING
tax_linesREPEATEDRECORD
tax_lines.compoundNULLABLEBOOLEAN
tax_lines.idNULLABLEINTEGER
tax_lines.labelNULLABLESTRING
tax_lines.rate_codeNULLABLESTRING
tax_lines.rate_idNULLABLEINTEGER
tax_lines.rate_percentNULLABLEINTEGER
tax_lines.shipping_tax_totalNULLABLEFLOAT
tax_lines.tax_totalNULLABLEFLOAT
refundsREPEATEDRECORD
refunds.idNULLABLEINTEGER
refunds.reasonNULLABLESTRING
refunds.totalNULLABLEFLOAT
totalNULLABLEFLOAT
total_taxNULLABLEFLOAT
transaction_idNULLABLESTRING
versionNULLABLESTRING
Schemat danych tabeli woocommerce_products
Field NameModeType
attributesREPEATEDRECORD
attributes.idNULLABLEINTEGER
attributes.nameNULLABLESTRING
attributes.optionsREPEATEDSTRING
attributes.positionNULLABLEINTEGER
attributes.variationNULLABLEBOOLEAN
attributes.visibleNULLABLEBOOLEAN
average_ratingNULLABLEFLOAT
backorderedNULLABLEBOOLEAN
backordersNULLABLESTRING
backorders_allowedNULLABLEBOOLEAN
brand_nameNULLABLESTRING
button_textNULLABLESTRING
catalog_visibilityNULLABLESTRING
categoriesREPEATEDRECORD
categories.idNULLABLEINTEGER
categories.nameNULLABLESTRING
categories.slugNULLABLESTRING
date_createdNULLABLETIMESTAMP
date_created_gmtNULLABLETIMESTAMP
date_modifiedNULLABLETIMESTAMP
date_modified_gmtNULLABLETIMESTAMP
descriptionNULLABLESTRING
dimensionsNULLABLERECORD
dimensions.heightNULLABLESTRING
dimensions.lengthNULLABLESTRING
dimensions.widthNULLABLESTRING
download_expiryNULLABLEINTEGER
download_limitNULLABLEINTEGER
downloadableNULLABLEBOOLEAN
external_urlNULLABLESTRING
featuredNULLABLEBOOLEAN
has_optionsNULLABLEBOOLEAN
idNULLABLEINTEGER
imagesREPEATEDRECORD
images.altNULLABLESTRING
images.date_createdNULLABLETIMESTAMP
images.date_created_gmtNULLABLETIMESTAMP
images.date_modifiedNULLABLETIMESTAMP
images.date_modified_gmtNULLABLETIMESTAMP
images.idNULLABLEINTEGER
images.nameNULLABLESTRING
images.srcNULLABLESTRING
manage_stockNULLABLEBOOLEAN
menu_orderNULLABLEINTEGER
meta_dataREPEATEDRECORD
meta_data.idNULLABLEINTEGER
meta_data.keyNULLABLESTRING
meta_data.valueNULLABLEJSON
nameNULLABLESTRING
on_saleNULLABLEBOOLEAN
parent_idNULLABLEINTEGER
permalinkNULLABLESTRING
priceNULLABLEFLOAT
price_htmlNULLABLESTRING
product_brandREPEATEDRECORD
product_brand.countNULLABLEINTEGER
product_brand.descriptionNULLABLESTRING
product_brand.filterNULLABLESTRING
product_brand.nameNULLABLESTRING
product_brand.parentNULLABLEINTEGER
product_brand.slugNULLABLESTRING
product_brand.taxonomyNULLABLESTRING
product_brand.term_groupNULLABLEINTEGER
product_brand.term_idNULLABLEINTEGER
product_brand.term_taxonomy_idNULLABLEINTEGER
product_typeREPEATEDRECORD
product_type.countNULLABLEINTEGER
product_type.descriptionNULLABLESTRING
product_type.filterNULLABLESTRING
product_type.nameNULLABLESTRING
product_type.parentNULLABLEINTEGER
product_type.slugNULLABLESTRING
product_type.taxonomyNULLABLESTRING
product_type.term_groupNULLABLEINTEGER
product_type.term_idNULLABLEINTEGER
product_type.term_taxonomy_idNULLABLEINTEGER
purchasableNULLABLEBOOLEAN
purchase_noteNULLABLESTRING
rating_countNULLABLEINTEGER
regular_priceNULLABLEFLOAT
related_idsREPEATEDINTEGER
reviews_allowedNULLABLEBOOLEAN
sale_priceNULLABLESTRING
shipping_classNULLABLESTRING
shipping_class_idNULLABLEINTEGER
shipping_requiredNULLABLEBOOLEAN
shipping_taxableNULLABLEBOOLEAN
short_descriptionNULLABLESTRING
skuNULLABLESTRING
slugNULLABLESTRING
sold_individuallyNULLABLEBOOLEAN
statusNULLABLESTRING
stock_quantityNULLABLEINTEGER
stock_statusNULLABLESTRING
tax_classNULLABLESTRING
tax_statusNULLABLESTRING
total_salesNULLABLEINTEGER
typeNULLABLESTRING
upsell_idsREPEATEDINTEGER
virtualNULLABLEBOOLEAN
weightNULLABLESTRING