top of page
Loja
bottom of page
import wixData from 'wix-data'; export function createPost(title, body, imageUrl, productURL) { wixData.insert('AutoPosts', { title: title, body: body, featuredImage: imageUrl, productLink: productURL }); }
function createKrabitzProductTypesSnippet() { // Define the header for the structured snippet. // You can choose from: Amenities, Brands, Courses, Degree programs, Destinations, // Featured hotels, Insurance coverage, Models, Neighborhoods, Service catalog, // Shows, Styles, Types. const snippetHeader = 'Types'; // Define the values for the snippet based on the product categories on Krabitz.com.br. [1] const snippetValues =; // Create the snippet extension builder. const snippetBuilder = AdsApp.extensions().newSnippetBuilder(); // Set the header and values for the snippet. snippetBuilder.withHeader(snippetHeader); snippetBuilder.withValues(snippetValues); // Optional: Set the snippet as mobile preferred. snippetBuilder.withMobilePreferred(false); // Build the snippet. const snippetOperation = snippetBuilder.build(); const snippetResult = snippetOperation.getResult(); // Check if the snippet was created successfully. if (snippetResult) { const snippet = snippetResult.getExtension(); Logger.log(`Successfully created snippet with ID: ${snippet.getId()}`); // To apply this snippet at the account level, uncomment the following lines: const account = AdsApp.currentAccount(); account.addSnippet(snippet); Logger.log(`Snippet added to account: ${account.getName()}`); // To apply this snippet at the campaign level, uncomment the following lines and replace with your campaign name: // const campaignIterator = AdsApp.campaigns().withCondition('campaign.name = "YOUR_CAMPAIGN_NAME_HERE"').get(); // if (campaignIterator.hasNext()) { // const campaign = campaignIterator.next(); // campaign.addSnippet(snippet); // Logger.log(`Snippet added to campaign: ${campaign.getName()}`); // } // To apply this snippet at the ad group level, uncomment the following lines and replace with your campaign and ad group names: // const adGroupIterator = AdsApp.adGroups() // .withCondition('campaign.name = "YOUR_CAMPAIGN_NAME_HERE"') // .withCondition('ad_group.name = "YOUR_AD_GROUP_NAME_HERE"') // .get(); // if (adGroupIterator.hasNext()) { // const adGroup = adGroupIterator.next(); // adGroup.addSnippet(snippet); // Logger.log(`Snippet added to ad group: ${adGroup.getName()}`); // } } else { Logger.log(`Failed to create snippet. Errors: ${snippetOperation.getErrors()}`); } } function main() { createKrabitzProductTypesSnippet(); }