Tying to create ads with multiple variations #224
RunyCalmera
started this conversation in
General
Replies: 2 comments 1 reply
-
Hi @RunyCalmera This is how you can create a DataFrame of ads, I think you need to flip the template and replacements something like this: import advertools as adv
import pandas as pd
products = ['Product A', 'Product B', 'Product C']
prices = ['$59', '$49']
h1 = adv.ad_create('Get the best {} today', replacements=products, fallback='product')
h2 = adv.ad_create('Get your own {} now', replacements=products, fallback='product')
h3 = 'Explore the best collection in town'
d1 = '100% Satisfaction Guaranteed: We strive to provide you with the best solutions'
d2 = '100% Satisfaction: Get your quality shoes today'
ads_df_1 = pd.DataFrame({
'Campaign': 'MY CAMPAIGN',
'Ad Group': 'My AdGroup',
'Headline 1': h1,
'Headline 2': h2,
'Headline 3': h3,
'Description 1': d1,
'Description 2': d2
})
ads_df_1 # then do the same with other variations
You can also check this tutorial for setting up SEM campaigns on a large scale. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Hi Elias,
Thanks!!!
Question:
If I have 5 h1 versions.
5, h2 versions
5, h3
Etc.
How can I loop through them and create one big dataframe?
Suppose I have these 5 versions of h1:
h11 = adv.ad_create('Buy your {} today', replacements=products,
fallback='product')
h12 = adv.ad_create('Get the best {} today', replacements=products,
fallback='product')
h13 = adv.ad_create('Great cheap {} now', replacements=products,
fallback='product')
h14 = adv.ad_create('Beautiful latest {} for this season',
replacements=products, fallback='product')
h15= adv.ad_create('Need a pair of {} today?', replacements=products,
fallback='product')
These are 5 variations on the h1 only.
I could think of 5 variations on the h2 text.
5 variations of the h3 text etc.
Now how can I loop through these 5 h1, 5 h2 texts etc and create a
dataframe with more rows/records?
Your dataframe has only 3 rows. I just want to have more rows, say 10
rows in my dataframe. So I want to figure out how to loop through the
code so I can create 10 rows. But I want to create one dataframe and loop through the many h1's and other fields of the dataframe untill I get say 10 ads.
Psuedo code:
1. Get a list of 5 h1 texts.#these are all the possible h1 texts I can imagine for this campaign.
2. Get a list of 5 h2 texts.# these are all the h2 texts I can imagine for this campaign.
3. Get a list of 5 h3 texts.# tgese are all the h3 I can imagine.
4. Get a list of 5 d1 texts.# these are all my possible descriptions for this campaign.
5. Get a list of 5 d2 texts.# these are all the d2 texts for this campaign.
Create a dataframe:
While there are h1’s in the list of h1 do this:
Create a record in the dataframe:
Put the h1 in it
Put the h2 in it
Put the h3 in it
Put the d1 in it
Put the d2 in it
Move to the next h1 in the list of h1's
Go to create a new record in the dataframe.
End
Explanation:
I can create a bunch of h1’s, h2’s, h3’s, d1’s and d2’s upfront and
then I get a dataframe with all the possible combinations.
So like 10-20 records in my ads dataframe.
Does this seem ok?
…On Thu, Jul 21, 2022 at 18:12 Elias Dabbas ***@***.***> wrote:
Hi @RunyCalmera <https://github.com/RunyCalmera>
This is how you can create a DataFrame of ads, I think you need to flip
the template and replacements something like this:
import advertools as advimport pandas as pd
products = ['Product A', 'Product B', 'Product C']prices = ['$59', '$49']
h1 = adv.ad_create('Get the best {} today', replacements=products, fallback='product')h2 = adv.ad_create('Get your own {} now', replacements=products, fallback='product')h3 = 'Explore the best collection in town'd1 = '100% Satisfaction Guaranteed: We strive to provide you with the best solutions'd2 = '100% Satisfaction: Get your quality shoes today'
ads_df_1 = pd.DataFrame({
'Campaign': 'MY CAMPAIGN',
'Ad Group': 'My AdGroup',
'Headline 1': h1,
'Headline 2': h2,
'Headline 3': h3,
'Description 1': d1,
'Description 2': d2
})
ads_df_1 # then do the same with other variations
Campaign Ad Group Headline 1 Headline 2 Headline 3 Description 1 Description
2
0 MY CAMPAIGN My AdGroup Get The Best Product A Today Get Your Own
Product A Now Explore the best collection in town 100% Satisfaction
Guaranteed: We strive to provide you with the best solutions 100%
Satisfaction: Get your quality shoes today
1 MY CAMPAIGN My AdGroup Get The Best Product B Today Get Your Own
Product B Now Explore the best collection in town 100% Satisfaction
Guaranteed: We strive to provide you with the best solutions 100%
Satisfaction: Get your quality shoes today
2 MY CAMPAIGN My AdGroup Get The Best Product C Today Get Your Own
Product C Now Explore the best collection in town 100% Satisfaction
Guaranteed: We strive to provide you with the best solutions 100%
Satisfaction: Get your quality shoes today
You can also check this tutorial for setting up SEM campaigns on a large
scale
<https://www.semrush.com/blog/setting-up-search-engine-marketing-campaigns-on-large-scale/>
.
—
Reply to this email directly, view it on GitHub
<#224 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AMPNBOY4LHJPFZE4WMMS6D3VVHDM7ANCNFSM54FYRRFQ>
.
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi
I'm trying to create a dataframe of ads with multiple variations. I have a series of more headline_1, headline_2 etc. How can I create one dataframe with multiple combinations? I thought it would be great to put all. my headline_1 variations together, headline_2 variations together and then let the system create one dataframe for ads with all the variations of these headlines. Just like the keywords are being created. Is this possible with the adv.ad_create() function? Or am I pushing it too far?
headline_1 = pd.Series(['Get the best {} today', 'Get your own {} now'])
headline_2 = pd.Series(['Prices starting at {}', 'Only {}'])
headline_3 = pd.Series(['Explore the best collection in town', 'Get the latest collection'])
description_1 = pd.Series(['100% Satisfaction Guaranteed: We strive to provide you with the best solutions',
'100% Satisfaction: Get your quality shoes today'])
description_2 = pd.Series(['we are confident that you will love these non skid slip sticky grippers socks',
'we are confident you will look great'])
prices = ['$59', '$49']
ads_total3 = pd.DataFrame({
'Campaign': campaigns.astype(str), # Just convert to string. Don't use title
'Ad Group': adgroups.str.title(),
'Headline 1': adv.ad_create(template='{}', replacements=headline_1,
fallback='$5', max_len=30, capitalize=True),
'Headline 2': adv.ad_create(template='{}', replacements=headline_2,
fallback='$5', max_len=30, capitalize=False),
'Headline 3': adv.ad_create(template='{}', replacements=headline_3,
fallback='$5', max_len=100, capitalize=False),
'Description 1': adv.ad_create(template='{}', replacements=description_1,
fallback='$5', max_len=100, capitalize=False),
'Description 2': adv.ad_create(template='{}', replacements=description_2,
fallback='$5', max_len=100, capitalize=False),
})
Beta Was this translation helpful? Give feedback.
All reactions