Search code examples
csvimacros

imacro not taking 2nd url


I am running a macro script which will upload urls from .csv sheet.

My code is as follows

VERSION BUILD=8881205 RECORDER=FX
TAB T=1
TAB CLOSEALLOTHERS
'SET !ERRORIGNORE YES
URL GOTO=about:newtab
'URL GOTO=https://www.google.com/analytics/web/?hl=en#report/visitors-
SET !DATASOURCE C:\Users\users\Downloads\ga_urls.csv
SET !DATASOURCE_COLUMNS 1
SET !DATASOURCE_LINE {{!LOOP}}
URL GOTO={{!COL1}}
WAIT SECONDS=1
TAG POS=6 TYPE=DIV ATTR=CLASS:_GAWc
WAIT SECONDS=1
'TAG POS=14 TYPE=DIV ATTR=CLASS:_GAPB
TAG POS=1 TYPE=DIV ATTR=CLASS:ID-new-acquisition-campaigns-subsection-item<SP>_GAz-_new_acquisition_campaigns_subsection<SP>ACTION-open<SP>TARGET-new-acquisition-campaigns-subsection<SP>_GAJc*
WAIT SECONDS=1
TAG POS=1 TYPE=A ATTR=TITLE:Organic<SP>Keywords&&CLASS:_GAg
WAIT SECONDS=1
TAG POS=1 TYPE=TD ATTR=CLASS:_GAYo
WAIT SECONDS=1
TAG POS=1 TYPE=SELECT ATTR=CLASS:ID-datecontrol-shortcuts<SP>ACTION-shortcuts<SP>TARGET-select<SP>_GAEB CONTENT=%last7days
WAIT SECONDS=1
TAG POS=1 TYPE=INPUT:CHECKBOX ATTR=TYPE:checkbox&&CLASS:ID-date_compare_mode<SP>_GAqzb CONTENT=YES
WAIT SECONDS=1
TAG POS=1 TYPE=INPUT:BUTTON ATTR=TYPE:button&&VALUE:Apply&&CLASS:ID-apply<SP>ACTION-apply<SP>TARGET-<SP>_GAD7b
WAIT SECONDS=1
SET !VAR1 NULL
SET !VAR2 NULL
TAG POS=1 TYPE=DIV ATTR=CLASS:_GAm8b&&TXT:* EXTRACT=HTM
WAIT SECONDS=1
SET !VAR1 EVAL("var s=\"{{!EXTRACT}}\"; s.search(/_GAXDb _GAFUb _GAIW/i);")
'SET !VAR1 EVAL("var s=\"{{!EXTRACT}}\"; s.trim()")
SET !EXTRACT NULL
TAG POS=1 TYPE=DIV ATTR=CLASS:_GAm8b&&TXT:* EXTRACT=TXT
WAIT SECONDS=1
SET !VAR2 EVAL("var s=\"{{!EXTRACT}}\"; s.trim();")
SET !EXTRACT NULL
TAG POS=1 TYPE=LI ATTR=CLASS:ID-accounts-summary-1<SP>_GAKFb&&TXT:* EXTRACT=TXT
SET !VAR3 EVAL("var s=\"{{!EXTRACT}}\"; s.trim()")
SET !EXTRACT NULL
ADD !EXTRACT {{!VAR1}}
ADD !EXTRACT {{!VAR2}}
ADD !EXTRACT {{!VAR3}}
SAVEAS TYPE=EXTRACT FOLDER=* FILE=values_ga_urls.csv
SET !VAR1 NULL
SET !VAR2 NULL
SET !VAR3 NULL

the code runs perfectly for 1st url and on 2nd url it gives error.

And if i uncomment SET !ERRORIGNORE YES i realized it took all alternative urls like 1st then 3rd then 5th.

And my .csv file is as follows enter image description here

Also if i manually put url in browser the page is opening so urls are valid.

I found it weird. Can anyone find what is the bug?

Thanks


Solution

  • Try this:

    1.Go back to home page of Google Analytics before script ends

    2.And then let new url(2nd row data from excel sheet be called in URL GOTO={{!COL1}})